function getIP() {
$ip;
if (getenv("HTTP_CLIENT_IP"))
$ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR"))
$ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR"))
$ip = getenv("REMOTE_ADDR");
else $ip = "Unknow";
if ($ip != "Unknow") {
list ($a, $b, $c, $d) = split ('.', $ip);
$ip = $a + '.' + $b + '.' + $c + '.***';
}
return $ip;
}
?>
echo getIP();
?>
|