![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
22/02/2004, 06:53
|
![Avatar de bichomen](http://static.forosdelweb.com/customavatars/avatar35353_1.gif) | | | Fecha de Ingreso: junio-2003 Ubicación: Barcelona y alrededores, España
Mensajes: 877
Antigüedad: 21 años, 8 meses Puntos: 2 | |
Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in / Me sale este error, y otros dos parecidos al intentar mostrar la ip del usuario que se conecta, utilizo un script para mostrar la ip verdadera, que obtuve de este foro:
<?php
function getip()
{
if ($_SERVER)
{
if ( $_SERVER[HTTP_X_FORWARDED_FOR] )
{
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
elseif ( $_SERVER["HTTP_CLIENT_IP"] )
{
$realip = $_SERVER["HTTP_CLIENT_IP"];
}
else
{
$realip = $_SERVER["REMOTE_ADDR"];
}
}
else
{
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) )
{
$realip = getenv( 'HTTP_X_FORWARDED_FOR' );
}
elseif ( getenv( 'HTTP_CLIENT_IP' ) )
{
$realip = getenv( 'HTTP_CLIENT_IP' );
}
else
{
$realip = getenv( 'REMOTE_ADDR' );
}
}
return $realip;
}
echo getip();
?>
bichomen
__________________ "Se sabe con exactitud, con cuanta imprecisión, se sabe algo"
Linux Registered User #320332 |