Advertisement
Guest User

Untitled

a guest
Apr 5th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.57 KB | None | 0 0
  1.     <?php
  2.      
  3.      
  4.     function limitatexto( $texto, $limite )
  5.       {
  6.         if( strlen($texto)>$limite )
  7.           {
  8.             $texto = substr( $texto,0,$limite );
  9.           }
  10.         return $texto;
  11.      
  12.       }
  13.      
  14.      
  15.      
  16.      
  17.      
  18.     function mostrarTemplate($tema, $variables)
  19.     {
  20.         //var_dump($variables);
  21.         extract($variables);
  22.         eval("?>".$tema."<?");
  23.     }
  24.      
  25.     function parsearTags($mensaje)
  26.     {
  27.         $mensaje = str_replace("[citar]", "<blockquote><hr width='100%' size='2'>", $mensaje);
  28.         $mensaje = str_replace("[/citar]", "<hr width='100%' size='2'></blockquote>", $mensaje);
  29.         return $mensaje;
  30.     }
  31.      
  32.     // funcion para validar email
  33.     function ValidaMail($pMail) {
  34.         if (ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@+([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$", $pMail ) ) {
  35.            return true;
  36.         } else {
  37.     echo "You Must Insert a Valid Email Address"; exit();
  38.         }
  39.     }
  40.      
  41.     // minimo de carateres
  42.     function minimo($contenido) {
  43.      
  44.     if (strlen($contenido) < 3) {
  45.      
  46.     echo "You Must Insert at least 3 chars.";include('footer.php'); exit();
  47.      
  48.     } else {
  49.      
  50.     // echo "todo bien...";
  51.     return $contenido;
  52.     }  
  53.     }
  54.      
  55.      
  56.     function minimopass($contenido) {
  57.      
  58.     if (strlen($contenido) < 6) {
  59.      
  60.     echo "You Must Insert at least 6 chars in password field.";include('footer.php'); exit();
  61.      
  62.     } else {
  63.      
  64.     // echo "todo bien...";
  65.     return $contenido;
  66.     }  
  67.     }
  68.      
  69.     // funcion para sanitizar variables
  70.     function limpiar($mensaje)
  71.     {
  72.     $mensaje = htmlentities(stripslashes(trim($mensaje)));
  73.     $mensaje = str_replace("'"," ",$mensaje);
  74.     $mensaje = str_replace(";"," ",$mensaje);
  75.     $mensaje = str_replace("$"," ",$mensaje);
  76.     return $mensaje;
  77.     }
  78.      
  79.     function shout($nombre_usuario){
  80.        if (ereg("^[a-zA-Z0-9\-_]{3,20}$", $nombre_usuario)) {
  81.     //      echo "El campo $nombre_usuario es correcto<br>";
  82.           return $nombre_usuario;
  83.        } else {
  84.            echo "The Field $nombre_usuario is not valid<br>";include('footer.php');
  85.     exit();
  86.        }
  87.     }
  88.      
  89.      
  90.      
  91.      
  92.     // universal cleaner function
  93.      
  94.      
  95.     function uc($mensaje)
  96.     {
  97.      
  98.      **LINHA 98>>**  if (ereg("^[a-zA-Z0-9\-_]{3,20}$", $mensaje)) {
  99.     //      echo "El campo $mensaje es correcto<br>";
  100.     $mensaje = htmlentities(stripslashes(strtolower(trim($mensaje))));
  101.     $mensaje = str_replace("'"," ",$mensaje);
  102.     $mensaje = str_replace(";"," ",$mensaje);
  103.     $mensaje = str_replace("$"," ",$mensaje);
  104.     return $mensaje;
  105.        } else {
  106.            echo "The Field $mensaje is not Valid<br>";include('footer.php');
  107.     exit();
  108.        }
  109.      
  110.     }
  111.      
  112.      
  113.      
  114.      
  115.      
  116.      
  117.      
  118.      
  119.     //funcion para añadir smylies
  120.      
  121.     function caretos($texto,$ruta)
  122.     {
  123.     $i="<img src=\"$ruta/";
  124.     $i_="\" >";
  125.     $texto=str_replace(":)",$i."icon_smile.gif".$i_,$texto);
  126.     $texto=str_replace(":D",$i."icon_biggrin.gif".$i_,$texto);
  127.     $texto=str_replace("^^",$i."icon_cheesygrin.gif".$i_,$texto);
  128.      
  129.     $texto=str_replace("xD",$i."icon_lol.gif".$i_,$texto);
  130.     $texto=str_replace("XD",$i."icon_lol.gif".$i_,$texto);
  131.      
  132.     $texto=str_replace(":|",$i."icon_neutral.gif".$i_,$texto);
  133.     $texto=str_replace(":(",$i."icon_sad.gif".$i_,$texto);
  134.     $texto=str_replace(":&#039(",$i."icon_cry.gif".$i_,$texto);
  135.     $texto=str_replace(":O",$i."icon_surprised.gif".$i_,$texto);
  136.     $texto=str_replace("B)",$i."icon_cool.gif".$i_,$texto);
  137.     $texto=str_replace("8|",$i."icon_rolleyes.gif".$i_,$texto);
  138.     $texto=str_replace("O_O",$i."icon_eek.gif".$i_,$texto);
  139.     $texto=str_replace(":P",$i."icon_razz.gif".$i_,$texto);
  140.     $texto=str_replace(":?",$i."icon_confused.gif".$i_,$texto);
  141.     $texto=str_replace("^:@",$i."icon_evil.gif".$i_,$texto);
  142.     $texto=str_replace("^_-",$i."icon_frown.gif".$i_,$texto);
  143.     $texto=str_replace("!(",$i."icon_mad.gif".$i_,$texto);
  144.     $texto=str_replace("^)",$i."icon_twisted.gif".$i_,$texto);
  145.     $texto=str_replace(";)",$i."icon_wink.gif".$i_,$texto);
  146.     $texto=str_replace(":B",$i."drool.gif".$i_,$texto);
  147.     return $texto;
  148.     }
  149.      
  150.     // ip real
  151.     function getRealIP()
  152.     {
  153.        
  154.        if( $_SERVER['HTTP_X_FORWARDED_FOR'] != '' )
  155.        {
  156.           $client_ip =
  157.              ( !empty($_SERVER['REMOTE_ADDR']) ) ?
  158.                 $_SERVER['REMOTE_ADDR']
  159.                 :
  160.                 ( ( !empty($_ENV['REMOTE_ADDR']) ) ?
  161.                    $_ENV['REMOTE_ADDR']
  162.                    :
  163.                    "unknown" );
  164.        
  165.           // los proxys van añadiendo al final de esta cabecera
  166.           // las direcciones ip que van "ocultando". Para localizar la ip real
  167.           // del usuario se comienza a mirar por el principio hasta encontrar
  168.           // una dirección ip que no sea del rango privado. En caso de no
  169.           // encontrarse ninguna se toma como valor el REMOTE_ADDR
  170.        
  171.           $entries = split('[, ]', $_SERVER['HTTP_X_FORWARDED_FOR']);
  172.        
  173.           reset($entries);
  174.           while (list(, $entry) = each($entries))
  175.           {
  176.              $entry = trim($entry);
  177.              if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list) )
  178.              {
  179.                 // http://www.faqs.org/rfcs/rfc1918.html
  180.                 $private_ip = array(
  181.                       '/^0\./',
  182.                       '/^127\.0\.0\.1/',
  183.                       '/^192\.168\..*/',
  184.                       '/^172\.((1[6-9])|(2[0-9])|(3[0-1]))\..*/',
  185.                       '/^10\..*/');
  186.        
  187.                 $found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
  188.        
  189.                 if ($client_ip != $found_ip)
  190.                 {
  191.                    $client_ip = $found_ip;
  192.                    break;
  193.                 }
  194.              }
  195.           }
  196.        }
  197.        else
  198.        {
  199.           $client_ip =
  200.              ( !empty($_SERVER['REMOTE_ADDR']) ) ?
  201.                 $_SERVER['REMOTE_ADDR']
  202.                 :
  203.                 ( ( !empty($_ENV['REMOTE_ADDR']) ) ?
  204.                    $_ENV['REMOTE_ADDR']
  205.                    :
  206.                    "unknown" );
  207.        }
  208.        
  209.        return $client_ip;
  210.        
  211.     }
  212.      
  213.     ?>  >Deprecated: Function ereg() is deprecated in /home/u844214382/public_html/funciones.php on line 98 Deprecated:
  214.  
  215. **Código na linha 98:**
  216.  
  217.     if (ereg("^[a-zA-Z0-9\-_]{3,20}$", $mensaje)) {
  218.  
  219. Existem ainda outras chamadas a `ereg` no mesmo arquivo.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement