//
function get_real_ip()
{
$ip=false;
$clientip = "clientip";
$xrealip = "xrealip";
$userip ='userip';
$fwip ='fwip';
$aliip = 'aliip';
$forwardedip ='forwardedip';
if(isset($_SERVER["HTTP_CLIENT_IP"]) && !empty($_SERVER['HTTP_CLIENT_IP']) && !preg_match("/^(10|172.16|192.168)./i",$_SERVER['HTTP_CLIENT_IP']) && $_SERVER["HTTP_CLIENT_IP"]!='118.26.171.83' && $_SERVER["HTTP_CLIENT_IP"]!='118.26.171.84')
{
$ip = $_SERVER["HTTP_CLIENT_IP"];
$clientip = $_SERVER["HTTP_CLIENT_IP"];
}
else if(isset($_SERVER["HTTP_X_REAL_IP"]) && !empty($_SERVER['HTTP_X_REAL_IP']) && !preg_match("/^(10|172.16|192.168)./i",$_SERVER['HTTP_X_REAL_IP']) && $_SERVER["HTTP_X_REAL_IP"]!='118.26.171.83' && $_SERVER["HTTP_X_REAL_IP"]!='118.26.171.84')
{
$ip = $_SERVER['HTTP_X_REAL_IP'];
$xrealip = $_SERVER["HTTP_X_REAL_IP"];
}
else if(isset($_SERVER["HTTP_USER_IP"]) && !empty($_SERVER['HTTP_USER_IP']) && !preg_match("/^(10|172.16|192.168)./i",$_SERVER['HTTP_USER_IP']) && $_SERVER["HTTP_USER_IP"]!='118.26.171.83' && $_SERVER["HTTP_USER_IP"]!='118.26.171.84')
{
$ip = $_SERVER['HTTP_USER_IP'];
$userip =$_SERVER['HTTP_USER_IP'];
}
else if(isset($_SERVER["HTTP_FW_ADDR"]) && !empty($_SERVER['HTTP_FW_ADDR']) && !preg_match("/^(10|172.16|192.168)./i",$_SERVER['HTTP_FW_ADDR']) && $_SERVER["HTTP_FW_ADDR"]!='118.26.171.83' && $_SERVER["HTTP_FW_ADDR"]!='118.26.171.84')
{
$ip = $_SERVER['HTTP_FW_ADDR'];
$fwip = $_SERVER["HTTP_FW_ADDR"];
}
else if(isset($_SERVER["HTTP_ALI_CDN_REAL_IP"]) && !empty($_SERVER['HTTP_ALI_CDN_REAL_IP']) && !preg_match("/^(10|172.16|192.168)./i",$_SERVER['HTTP_ALI_CDN_REAL_IP']) && $_SERVER["HTTP_ALI_CDN_REAL_IP"]!='118.26.171.83' && $_SERVER["HTTP_ALI_CDN_REAL_IP"]!='118.26.171.84')
{
$ip = $_SERVER['HTTP_ALI_CDN_REAL_IP'];
$aliip = $_SERVER["HTTP_ALI_CDN_REAL_IP"];
}
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip)
{
array_push($ips, $ip);
$ip = FALSE;
}
for ($i = 0; $i < count($ips); $i++)
{
if (isset($ips[$i]) && !preg_match("/^(10|172.16|192.168)./i", $ips[$i]) && $ips[$i]!='118.26.171.83' && $ips[$i]!='118.26.171.84')
{
$ip = $ips[$i];
break;
}
}
$forwardedip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}