|
Sometimes a browser may be hiding behind a proxy, – this little function will hopefully get to the root of things:
function userIP(){
// Returns the True IP of the client calling the requested page by first checking to see if HTTP_X_FORWARDED_FOR has a value (proxy)
$userIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
if($userIP == “”){
$userIP = $_SERVER['REMOTE_ADDR'];
}
// Return the IP we’ve figured out:
return $userIP;
}
// Returns the True IP of the client calling the requested page by first checking to see if HTTP_X_FORWARDED_FOR has a value (proxy)
$userIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
if($userIP == “”){
$userIP = $_SERVER['REMOTE_ADDR'];
}
// Return the IP we’ve figured out:
return $userIP;
}



| Based on a theme by Ori Pearl