Foro de elhacker.net

Programación => PHP => Mensaje iniciado por: lesone- en 10 Diciembre 2012, 17:22 pm



Título: ayuda para una condición "IF"
Publicado por: lesone- en 10 Diciembre 2012, 17:22 pm

Buenas compañeros.

Buenos os comento lo que quiero hacer. Trabajo en un foro y mi idea es que tengo un banner flotando invitando a registrarse.

Lo que me gustaría es cómo podría hacer para que dicho banner no me salga en el apartado de registros. Es decir, en un link en concreto.

Cómo podría hacerlo?

Saludos!!


Título: Re: ayuda para una condición "IF"
Publicado por: #!drvy en 10 Diciembre 2012, 17:28 pm
Código
  1. <?php
  2. $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  3. if($url=='blablabla'){
  4.   // No mostrar banner
  5. } else {
  6.   // Mostrar banner.
  7. }
  8. ?>

Saludos


Título: Re: ayuda para una condición "IF"
Publicado por: lesone- en 10 Diciembre 2012, 18:09 pm
Gracias por tu pronta respuesta!!

Dónde podría poner dicha sentencia? Y con qué orden? Esque soy muy nuevo en esto.

Código:
<?php
/**
 *
 * Author: ArmyZ Rdz
 * Comaptible with: MyBB 1.4
 * Website: http://www.generalzone.net
 * License: GNU/GPL
 * Utilicelo a su propio riesgo
 * Disfrutalo =D
 *
 */
 
if(!defined('IN_MYBB'))
{
die();
}
$plugins->add_hook("global_start", "imgflotante");
function imgflotante_info(){
return array(
"name" => "Imagen Flotante Para Invitados",
"description" => "Este plugin muestra una imagen flotante para los invitados",
"website" => "http://www.generalzone.net",
"author" => "ArmyZ Rodriguez",
"authorsite" => "http://www.generalzone.net",
"version" => "1.2.1",
"compatibility" => "14*,16*",
"guid" => ""
);
}
function imgflotante_activate(){
  global $db;
 
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("header", "#".preg_quote('{$bannedwarning}')."#i", '{\$bannedwarning}{\$imgflotante}');
 
 $imgflotante_group = array(
'gid' => 'NULL',
'name' => 'imgflotante',
'title' => 'Imagen flotante para invitados',
'description' => 'Settings For The imgflotante Plugin',
'disporder' => "1",
'isdefault' => 'no',
);
$db->insert_query('settinggroups', $imgflotante_group);
$gid = $db->insert_id();

$imgflotante_setting_1 = array(
'sid' => 'NULL',
'name' => 'enabled_imgflotante',
'title' => 'Activado/Desactivado',
'description' => '',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 1,
'gid' => intval($gid),
);
$db->insert_query('settings', $imgflotante_setting_1);

$imgflotante_setting_2 = array(
'sid' => 'NULL',
'name' => 'imgflotante_location',
'title' => 'Arriva o Abajo?',
'description' => 'puedes poner "fromtop" para colocar la imagen arriva o "frombottom" para colocarla abajo',
'optionscode' => 'text',
'value' => 'fromtop',
'disporder' => 2,
'gid' => intval($gid),
);
$db->insert_query('settings', $imgflotante_setting_2);

$imgflotante_setting_3 = array(
'sid' => 'NULL',
'name' => 'imgflotante_img',
'title' => 'Ruta de la Imagen',
'description' => 'escribe la ruta nueva de tu imagen que se mostrara a los invitados...',
'optionscode' => 'text',
'value' => 'images/ifid.png',
'disporder' => 3,
'gid' => intval($gid),
);
$db->insert_query('settings', $imgflotante_setting_3);

$imgflotante_setting_4 = array(
'sid' => 'NULL',
'name' => 'imgflotante_img_close',
'title' => 'Ruta de la Imagen para cerrar',
'description' => 'escribe la ruta nueva de tu imagen que se mostrara a los invitados donde se cerrara...',
'optionscode' => 'text',
'value' => 'images/ifii.png',
'disporder' => 4,
'gid' => intval($gid),
);
$db->insert_query('settings', $imgflotante_setting_4);


rebuild_settings();
}
function imgflotante_deactivate(){
  global $db;

include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("header", "#".preg_quote('{$imgflotante}')."#i", '', 0);

$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('imgflotante_location','enabled_imgflotante','imgflotante_img','imgflotante_img_close')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='imgflotante'");
rebuild_settings();

}
function imgflotante()
{
global $mybb;
if ($mybb->settings['enabled_imgflotante'] == 1)
    {
if($mybb->user['usergroup']==1)

{
global $templates,$settings,$imgflotante;
$imgflotante = '<script type="text/javascript" src="jscripts/imgflotante.js?ver=1400"></script>
<script type="text/javascript">
var verticalpos = "'.$mybb->settings['imgflotante_location'].'";
</script>
<style type="text/css">#topbar{position:absolute;border: 0px solid white;padding: 5px;background-color: transparent;width: 450px;visibility: hidden;z-index: 400;}</style><div id="topbar"><a href="'.$mybb->settings['bburl'].'/member.php?action=register"><img src="'.$mybb->settings['imgflotante_img'].'"" alt="Registrarte!" border="0" /></a><a href="#" onclick="closebar(); return false"><img src="'.$mybb->settings['imgflotante_img_close'].'" alt="Cerrar" border="0" /></a></div>';
}
    }

}
?>


Título: Re: ayuda para una condición "IF"
Publicado por: & eDu & en 12 Diciembre 2012, 02:07 am
Código
  1. <?php
  2. /**
  3.  *
  4.  * Author: ArmyZ Rdz
  5.  * Comaptible with: MyBB 1.4
  6.  * Website: http://www.generalzone.net
  7.  * License: GNU/GPL
  8.  * Utilicelo a su propio riesgo
  9.  * Disfrutalo =D
  10.  *
  11.  */
  12.  
  13. if(!defined('IN_MYBB'))
  14. {
  15. die();
  16. }
  17. $plugins->add_hook("global_start", "imgflotante");
  18. function imgflotante_info(){
  19. return array(
  20. "name" => "Imagen Flotante Para Invitados",
  21. "description" => "Este plugin muestra una imagen flotante para los invitados",
  22. "website" => "http://www.generalzone.net",
  23. "author" => "ArmyZ Rodriguez",
  24. "authorsite" => "http://www.generalzone.net",
  25. "version" => "1.2.1",
  26. "compatibility" => "14*,16*",
  27. "guid" => ""
  28. );
  29. }
  30. function imgflotante_activate(){
  31.  global $db;
  32.  
  33. include MYBB_ROOT."/inc/adminfunctions_templates.php";
  34. find_replace_templatesets("header", "#".preg_quote('{$bannedwarning}')."#i", '{\$bannedwarning}{\$imgflotante}');
  35.  
  36. $imgflotante_group = array(
  37. 'gid' => 'NULL',
  38. 'name' => 'imgflotante',
  39. 'title' => 'Imagen flotante para invitados',
  40. 'description' => 'Settings For The imgflotante Plugin',
  41. 'disporder' => "1",
  42. 'isdefault' => 'no',
  43. );
  44. $db->insert_query('settinggroups', $imgflotante_group);
  45. $gid = $db->insert_id();
  46.  
  47. $imgflotante_setting_1 = array(
  48. 'sid' => 'NULL',
  49. 'name' => 'enabled_imgflotante',
  50. 'title' => 'Activado/Desactivado',
  51. 'description' => '',
  52. 'optionscode' => 'yesno',
  53. 'value' => '1',
  54. 'disporder' => 1,
  55. 'gid' => intval($gid),
  56. );
  57. $db->insert_query('settings', $imgflotante_setting_1);
  58.  
  59. $imgflotante_setting_2 = array(
  60. 'sid' => 'NULL',
  61. 'name' => 'imgflotante_location',
  62. 'title' => 'Arriva o Abajo?',
  63. 'description' => 'puedes poner "fromtop" para colocar la imagen arriva o "frombottom" para colocarla abajo',
  64. 'optionscode' => 'text',
  65. 'value' => 'fromtop',
  66. 'disporder' => 2,
  67. 'gid' => intval($gid),
  68. );
  69. $db->insert_query('settings', $imgflotante_setting_2);
  70.  
  71. $imgflotante_setting_3 = array(
  72. 'sid' => 'NULL',
  73. 'name' => 'imgflotante_img',
  74. 'title' => 'Ruta de la Imagen',
  75. 'description' => 'escribe la ruta nueva de tu imagen que se mostrara a los invitados...',
  76. 'optionscode' => 'text',
  77. 'value' => 'images/ifid.png',
  78. 'disporder' => 3,
  79. 'gid' => intval($gid),
  80. );
  81. $db->insert_query('settings', $imgflotante_setting_3);
  82.  
  83. $imgflotante_setting_4 = array(
  84. 'sid' => 'NULL',
  85. 'name' => 'imgflotante_img_close',
  86. 'title' => 'Ruta de la Imagen para cerrar',
  87. 'description' => 'escribe la ruta nueva de tu imagen que se mostrara a los invitados donde se cerrara...',
  88. 'optionscode' => 'text',
  89. 'value' => 'images/ifii.png',
  90. 'disporder' => 4,
  91. 'gid' => intval($gid),
  92. );
  93. $db->insert_query('settings', $imgflotante_setting_4);
  94.  
  95.  
  96. rebuild_settings();
  97. }
  98. function imgflotante_deactivate(){
  99.  global $db;
  100.  
  101. include MYBB_ROOT."/inc/adminfunctions_templates.php";
  102. find_replace_templatesets("header", "#".preg_quote('{$imgflotante}')."#i", '', 0);
  103.  
  104. $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('imgflotante_location','enabled_imgflotante','imgflotante_img','imgflotante_img_close')");
  105. $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='imgflotante'");
  106. rebuild_settings();
  107.  
  108. }
  109. function imgflotante()
  110. {
  111. global $mybb;
  112. if ($mybb->settings['enabled_imgflotante'] == 1)
  113.    {
  114. if($mybb->user['usergroup']==1)
  115.  
  116. {
  117.                $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  118.                if($url!='AQUI PONES LA URL DEL REGISTRO EJ: HTTP://WWW.TUWEB.COM/REGISTRO'){
  119.  
  120. global $templates,$settings,$imgflotante;
  121. $imgflotante = '<script type="text/javascript" src="jscripts/imgflotante.js?ver=1400"></script>
  122. <script type="text/javascript">
  123. var verticalpos = "'.$mybb->settings['imgflotante_location'].'";
  124. </script>
  125. <style type="text/css">#topbar{position:absolute;border: 0px solid white;padding: 5px;background-color: transparent;width: 450px;visibility: hidden;z-index: 400;}</style><div id="topbar"><a href="'.$mybb->settings['bburl'].'/member.php?action=register"><img src="'.$mybb->settings['imgflotante_img'].'"" alt="Registrarte!" border="0" /></a><a href="#" onclick="closebar(); return false"><img src="'.$mybb->settings['imgflotante_img_close'].'" alt="Cerrar" border="0" /></a></div>';
  126.                        }
  127. }
  128.    }
  129.  
  130. }
  131. ?>
  132.  
En la última función.