Codice: |
function get_ip() {
$client_ip = get_client_ip(); // HTTP_CLIENT_IP
$x_forwarded = get_x_forwarded(); // HTTP_X_FORWARDED_FOR
$remote_addr = get_remote_addr(); // REMOTE_ADDR
if (isset($client_ip) && $client_ip != "none") {
return $client_ip;
} elseif (isset($x_forwarded) && $x_forwarded != "none") {
return $x_forwarded;
} elseif (isset($remote_addr) && $remote_addr != "none") {
return $remote_addr;
} else {
return "none";
}
} |
Codice: |
function get_ip() {
$client_ip = get_client_ip(); // HTTP_CLIENT_IP
$x_forwarded = get_x_forwarded(); // HTTP_X_FORWARDED_FOR
$remote_addr = get_remote_addr(); // REMOTE_ADDR
if (isset($client_ip) && !eregi("none", $client_ip) && !eregi("unknown", $client_ip)) {
return $client_ip;
} elseif (isset($x_forwarded) && !eregi("none", $x_forwarded) && !eregi("unknown", $x_forwarded)) {
return $x_forwarded;
} elseif (isset($remote_addr) && !eregi("none", $remote_addr) && !eregi("unknown", $remote_addr)) {
return $remote_addr;
} else {
return "none";
}
} |