经测试代码如下: @H_502_3@
/**
* 获取真实 IP 地址
*
* @param
* @author 编程之家 jb51.cc jb51.cc
**/
function getRealIpAddr()//
{
if (!emptyempty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!emptyempty($_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;
}
/*** 代码来自编程之家 jb51.cc(jb51.cc) ***/