You must be using $_SERVER['REMOTE_ADDR'] in PHP to find the visitor's IP address. and you may also know that this will not return the true IP all the time, Because if your client is using the Proxy server then this will return back your client's proxy IP, so this is not correct all the time. to get the real IP of your visitor follow the steps.
First of all you need to make the function :
Thanks, and i hope this works :)
First of all you need to make the function :
/*
* ComsGuru.blogspot.com
* Prakash Timilsina
*/
function TraceRealiP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
* ComsGuru.blogspot.com
* Prakash Timilsina
*/
function TraceRealiP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
Thanks, and i hope this works :)
goood
Posted on March 9, 2010 at 2:50 AM