I use this function to find the ip of the user.
I had xp pro and it worked ok when I was working at localhost.
Now I moved at Vista business and the ip (of localhost-my pc) that is returning is
-as I find from debugging it is the $_SERVER[‘REMOTE_ADDR’]
what is wrong?
public function getRealIpAddr() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else {
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}