Jun 18, 2004 #1 rbauerle Programmer Joined Oct 16, 2001 Messages 48 Location BR How do I get the user's ip address? Tks.
Jun 18, 2004 #2 DRJ478 IS-IT--Management Joined Aug 10, 2001 Messages 2,264 Location US Usually: $_SERVER['REMOTE_ADDR'] However, there could be X_FORWARDED_FOR values etc. for proxied requests. IP is not telling you much - also remember that IPv4 is not spoof-proof. Upvote 0 Downvote
Usually: $_SERVER['REMOTE_ADDR'] However, there could be X_FORWARDED_FOR values etc. for proxied requests. IP is not telling you much - also remember that IPv4 is not spoof-proof.
Jun 18, 2004 1 #3 iranor Programmer Joined Jun 17, 2004 Messages 174 Location CA If you want the IP and Host : if (getenv("HTTP_X_FORWARDED_FOR")){ $ip=getenv("HTTP_X_FORWARDED_FOR"); } else { $ip=getenv("REMOTE_ADDR"); } $hostname = gethostbyaddr($ip); Here , $hostname : display user's hostname $ip : display user's ip Upvote 0 Downvote
If you want the IP and Host : if (getenv("HTTP_X_FORWARDED_FOR")){ $ip=getenv("HTTP_X_FORWARDED_FOR"); } else { $ip=getenv("REMOTE_ADDR"); } $hostname = gethostbyaddr($ip); Here , $hostname : display user's hostname $ip : display user's ip
Jun 18, 2004 Thread starter #4 rbauerle Programmer Joined Oct 16, 2001 Messages 48 Location BR that was very, very usefull. Tks again Upvote 0 Downvote