Below is a method I use to detect the IP Address and Host Name as well as Proxy Information of a visitors.
-
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){
-
// for proxy
-
$IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
-
$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
-
}else{
-
// for normal user
-
$IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];
-
}
gr8 code .i was searching for it ,& u helped me a lot thnkss!!!
Glad I could be of assistance Singh 🙂
I tried it, but it does not give me correct output. My PHP page is behind a proxy and when I try to execute this code, the application shows all blank values!! 🙁