Re: Problem with REMOTE_ADDR
| From: | Leif K-Brooks | Date: | Mon, 16 Sep 2002 22:27:19 +0000 |
| Subject: | Re: Problem with REMOTE_ADDR | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116570@lists.php.net to get a copy of this message | ||
Have you tried a web site such as www.getmyipaddress.com to see if it's on your end or your script's?
Chris Cook wrote:
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