Problem with REMOTE_ADDR
| From: | Chris Cook | Date: | Mon, 16 Sep 2002 18:42:45 +0000 |
| Subject: | Problem with REMOTE_ADDR | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116556@lists.php.net to get a copy of this message | ||
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