标签:blog http io for ar div cti log on
function getip(){
if (getenv(‘HTTP_CLIENT_IP‘))
{
$ip = getenv(‘HTTP_CLIENT_IP‘); //可伪造
}
elseif (getenv(‘HTTP_X_FORWARDED_FOR‘))
{
$ip = getenv(‘HTTP_X_FORWARDED_FOR‘); //可伪造
}
elseif (getenv(‘HTTP_X_FORWARDED‘))
{
$ip = getenv(‘HTTP_X_FORWARDED‘);
}
elseif (getenv(‘HTTP_FORWARDED_FOR‘))
{
$ip = getenv(‘HTTP_FORWARDED_FOR‘);
}
elseif (getenv(‘HTTP_FORWARDED‘))
{
$ip = getenv(‘HTTP_FORWARDED‘);
}
else
{
$ip = $_SERVER[‘REMOTE_ADDR‘];
}
return $ip;
}
php获取用户ip
标签:blog http io for ar div cti log on
原文地址:http://www.cnblogs.com/chenzhaojx/p/3939049.html