Possible Duplicate:
How do I find a user's IP address with PHP?
How can I get the user's IP address in PHP?
I make application web based. I want to show the IP address of the user/visitor who visit my web. I've used the script to find the IP address but it didn't work and no IP show. How to solve it?? do I miss something? This is my php script :
function get_ip()
{
global $ip;
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;
}
$ip = get_ip();
Please, I really need your help ! Thank you ...