日期:2014-05-17 浏览次数:20521 次
function curIp(){
$ip='';
if(getenv('HTTP_CLIENT_IP') and strcasecmp(getenv('HTTP_CLIENT_IP'),'unknown')){
$ip=getenv('HTTP_CLIENT_IP');
}elseif(getenv('HTTP_X_FORWARDED_FOR') and strcasecmp(getenv('HTTP_X_FORWARDED_FOR'),'unknown')){
$ip=getenv('HTTP_X_FORWARDED_FOR');
}elseif(getenv('REMOTE_ADDR') and strcasecmp(getenv('REMOTE_ADDR'),'unknown')){
$ip=getenv('REMOTE_ADDR');
}elseif(isset($_SERVER['REMOTE_ADDR']) and $_SERVER['REMOTE_ADDR'] and strcasecmp($_SERVER['REMOTE_ADDR'],'unknown')){
$ip=$_SERVER['REMOTE_ADDR'];
}else{
$ip='127.0.0.1';
}
return $ip;
}