RE: [PHP] Problem with REMOTE_ADDR
| From: | Chris Cook | Date: | Mon, 16 Sep 2002 20:13:09 +0000 |
| Subject: | RE: [PHP] Problem with REMOTE_ADDR | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116565@lists.php.net to get a copy of this message | ||
It should not being going through a proxy, but the way this campus is set up, that is a possibility. Even still, I used code that should have controlled for that. I have tested REMOTE_ADDR from several different IPs and it still gives me the server IP.
Thanks for any help,
Chris
From: "Adam Plocher" <aplocher@erepublic.com> To: "Chris Cook" <cjc1800@hotmail.com>,<php-general@lists.php.net> Subject: RE: [PHP] Problem with REMOTE_ADDR Date: Mon, 16 Sep 2002 12:01:44 -0700 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com