Quote:
function fetch_remote_address() {
$_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
# Record basic remote address.
$remote_address = $_SERVER['REMOTE_ADDR'];
# Take proxies into consideration or IPs behind a LAN.
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != 'unknown' && $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR']) {
$HXFF_temp = preg_replace('/, ?unknown/i','',$_SERVER['HTTP_X_FORWARDED_FOR']); // Remove any trailing 'unknowns'.
$remote_address .= ','.$HXFF_temp;
}
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != 'unknown' && $_SERVER['HTTP_CLIENT_IP'] != $_SERVER['HTTP_X_FORWARDED_FOR'] && $_SERVER['HTTP_CLIENT_IP'] != $_SERVER['REMOTE_ADDR']) {
$HCI_temp = preg_replace('/, ?unknown/i','',$_SERVER['HTTP_CLIENT_IP']); // Remove any trailing 'unknowns'.
$remote_address .= ','.$HCI_temp;
}
return $remote_address;
#die(fetch_remote_address());
}
|
Boomer is that the right way to put die(fetch_remote_address());