Pages

Get IP address

Returns the real IP address of a visitor, even when connecting via a proxy.function getRealIpAddr(){
02.if (!empty($_SERVER['HTTP_CLIENT_IP'])){
03.//check ip from share internet
04.$ip = $_SERVER['HTTP_CLIENT_IP'];
05.}
06.elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
07.//to check ip is pass from proxy
08.$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
09.}
10.else{
11.$ip = $_SERVER['REMOTE_ADDR'];
12.}
13.return $ip;
14.}

No comments:

Post a Comment