= '".$ip."') AND (begin_num <= '".$ipnum."') AND (end_num >= '".$ipnum."')"); if(mysql_num_rows($result)){ $r = mysql_fetch_array($result); $datareturn = array(); $datareturn['country']=$r['country']; $datareturn['country_code']=$r['countryAbr']; $datareturn['ip']=$ip; $datareturn['ip_num']=$ipnum; return $datareturn; }else{ return "GS"; } } function getUserIP() { if(!empty($_SERVER['HTTP_CLIENT_IP']) ){ $ip = $_SERVER['HTTP_CLIENT_IP']; }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } ?>