
May 30th, 2000, 11:11 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
$ip = $ENV{'REMOTE_ADDR'};
$n = `nslookup $ip | grep Name`; chop($n);
$host = substr($n, rindex($n, " ")+1);
if ($host eq "") {
$host=$ENV{'REMOTE_ADDR'};
}
$ip is the IP address and $host is the Host address. If $ip cannot resolve to $host, $host = $ip so $host won't give you a blank value.
|