<?
function iptype1 () {
if (getenv("http_client_ip")) {
return getenv("http_client_ip");
}
else {
return "none";
}
}
function iptype2 () {
if (getenv("http_x_forwarded_for")) {
return getenv("http_x_forwarded_for");
}
else {
return "none";
}
}
function iptype3 () {
if (getenv("remote_addr")) {
return getenv("remote_addr");
}
else {
return "none";
}
}
function ip() {
$ip1 = iptype1();
$ip2 = iptype2();
$ip3 = iptype3();
if (isset($ip1) && $ip1 != "none" && $ip1 != "unknown") {
return $ip1;
}
elseif (isset($ip2) && $ip2 != "none" && $ip2 != "unknown") {
return $ip2;
}
elseif (isset($ip3) && $ip3 != "none" && $ip3 != "unknown") {
return $ip3;
}
else {
return "none";
}
}
echo ip();
?>
新闻热点
疑难解答