How can i find the original IP address of a spoofed IP address开发者_如何学C?Is there any tools to find out?
This should do the trick:
function check_spoofed_ip()
{
//Check Ip in HTTP Header
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
//Is it Proxy Forwarded?
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
//Check @ Last, Normal Scenario
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip; //Returns Real IP
}
精彩评论