RE: [PHP] Problem with REMOTE_ADDR
| From: | Adam Plocher | Date: | Mon, 16 Sep 2002 19:01:44 +0000 |
| Subject: | RE: [PHP] Problem with REMOTE_ADDR | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116559@lists.php.net to get a copy of this message | ||
If your web server is going through a proxy it's possible you will get
the proxy IP with REMOTE_ADDR.. I could be wrong
-----Original Message-----
From: Chris Cook [mailto:cjc1800@hotmail.com]
Sent: Monday, September 16, 2002 11:43 AM
To: php-general@lists.php.net
Subject: [PHP] Problem with REMOTE_ADDR
Hello all,
Whenever I use REMOTE_ADDR, it gives me the IP of the server. Of course,
I
am not interested in this and want the IP of the client. I put this code
in
to resolve it and it still didnt work. What am I doing wrong?
Thanks for any help in advance,
Chris
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ip = getenv('HTTP_X_FORWARD_FOR');
$host = gethostbyaddr($ip);
} else {
$ip = getenv('REMOTE_ADDR');
$host = gethostbyaddr($ip);
}
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php