![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
25/10/2004, 10:28
|
O_O | | Fecha de Ingreso: enero-2002 Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 23 años, 1 mes Puntos: 129 | |
Podrias usar: Cita: webmaster at 4so9 dot com
25-Dec-2002 03:12
I could never get one host name from this function. I have even tried to turn on "HostnameLookup On" w/o success. I have combined all your your advises into this piece of codes. Any help on this is greatly appreciated.
------
function getRemoteInfo () {
$proxy="";
$IP = "";
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy = $_SERVER["REMOTE_ADDR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$IP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$IP = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$IP = getenv( 'HTTP_X_FORWARDED_FOR' );
$proxy = getenv( 'REMOTE_ADDR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$IP = getenv( 'HTTP_CLIENT_IP' );
} else {
$IP = getenv( 'REMOTE_ADDR' );
}
}
if (strstr($IP, ',')) {
$ips = explode(',', $IP);
$IP = $ips[0];
}
$RemoteInfo[0]=$IP;
$RemoteInfo[1]=@GetHostByAddr($IP);
$RemoteInfo[2]=$proxy;
return $RemoteInfo;
}
http://www.php.net/manual/es/function.gethostbyaddr.php |