1public function getUserIpAddr(){
2 $ipaddress = '';
3 if (isset($_SERVER['HTTP_CLIENT_IP']))
4 $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
5 else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
6 $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
7 else if(isset($_SERVER['HTTP_X_FORWARDED']))
8 $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
9 else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
10 $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
11 else if(isset($_SERVER['HTTP_FORWARDED']))
12 $ipaddress = $_SERVER['HTTP_FORWARDED'];
13 else if(isset($_SERVER['REMOTE_ADDR']))
14 $ipaddress = $_SERVER['REMOTE_ADDR'];
15 else
16 $ipaddress = 'UNKNOWN';
17 return $ipaddress;
18 }
19