Вход Регистрация
Файл: public_html/funciones.php
Строк: 96
<?php

function limitatexto( $texto, $limite )
  {
    if( 
strlen($texto)>$limite )
      {
        
$texto = substr( $texto,0,$limite );
      }
    return 
$texto;

  }


function 
mostrarTemplate($tema, $variables)
{
    
extract($variables);
    eval(
"?>".$tema."<?");
}

function 
parsearTags($mensaje)
{
    
$mensaje = str_replace("[citar]", "<blockquote><hr width='100%' size='2'>", $mensaje);
    
$mensaje = str_replace("[/citar]", "<hr width='100%' size='2'></blockquote>", $mensaje);
    return 
$mensaje;
}

function 
minimo($contenido) {

if (
strlen($contenido) < 3) {

echo 
"Ваш логин должен быть по крайней мере из 3 символов.";include('footer.php'); exit();

} else {

return 
$contenido;
}
}

function 
minimopass($contenido) {

if (
strlen($contenido) < 5) {

echo 
"Ваш пароль должен быть по крайней мере из 5 символов.";include('footer.php'); exit();

} else {

return 
$contenido;
}
}

function 
limpiar($mensaje)
{
$mensaje = htmlentities(stripslashes(trim($mensaje)));
$mensaje = str_replace("'"," ",$mensaje);
$mensaje = str_replace(";"," ",$mensaje);
$mensaje = str_replace("$"," ",$mensaje);
return 
$mensaje;
}

function 
uc($mensaje)
{
   if (
ereg("^[a-zA-Zа-яА-Я0-9-_]{1,255}$", $mensaje)) {
    
$mensaje = htmlentities(stripslashes(strtolower(trim($mensaje))));
    
$mensaje = str_replace("'"," ",$mensaje);
    
$mensaje = str_replace(";"," ",$mensaje);
    
$mensaje = str_replace("$"," ",$mensaje);
    return 
$mensaje;
   }else{ return 
$mensaje; }
}

function 
getRealIP()
{

   if( 
$_SERVER['HTTP_X_FORWARDED_FOR'] != '' )
   {
      
$client_ip =
         ( !empty(
$_SERVER['REMOTE_ADDR']) ) ?
            
$_SERVER['REMOTE_ADDR']
            :
            ( ( !empty(
$_ENV['REMOTE_ADDR']) ) ?
               
$_ENV['REMOTE_ADDR']
               :
               
"unknown" );
      
$entries = split('[, ]', $_SERVER['HTTP_X_FORWARDED_FOR']);

      
reset($entries);
      while (list(, 
$entry) = each($entries))
      {
         
$entry = trim($entry);
         if ( 
preg_match("/^([0-9]+.[0-9]+.[0-9]+.[0-9]+)/", $entry, $ip_list) )
         {
            
// http://www.faqs.org/rfcs/rfc1918.html
            
$private_ip = array(
                  
'/^0./',
                  
'/^127.0.0.1/',
                  
'/^192.168..*/',
                  
'/^172.((1[6-9])|(2[0-9])|(3[0-1]))..*/',
                  
'/^10..*/');

            
$found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);

            if (
$client_ip != $found_ip)
            {
               
$client_ip = $found_ip;
               break;
            }
         }
      }
   }
   else
   {
      
$client_ip =
         ( !empty(
$_SERVER['REMOTE_ADDR']) ) ?
            
$_SERVER['REMOTE_ADDR']
            :
            ( ( !empty(
$_ENV['REMOTE_ADDR']) ) ?
               
$_ENV['REMOTE_ADDR']
               :
               
"unknown" );
   }

   return 
$client_ip;

}

?>
Онлайн: 2
Реклама