ip2country
| From: | Webmaster do Aborla.net | Date: | Wed, 17 Sep 2003 10:32:29 +0000 |
| Subject: | ip2country | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-21044@lists.php.net to get a copy of this message | ||
Hello,
I was recently looking to your website source code and I think you have made
a small error in the ip2country module.
I think you should only use the 'REMOTE_ADDR' var, instead of trying to find
the real user's ip using 'HTTP_X_FORWARDED_FOR', because you don't really
want to know the country of the client, you just want to know the ip of the
machine you are serving the website to.
For example, I'm in Portugal, but I can be using a proxy server in USA. It
would be faster if I had been redirected to a USA mirror.
If you really want to know the client's ip, you may want to check for the
following var: $_SERVER['HTTP_CLIENT_IP']. I've noticed the use of that var
in my server (some proxy servers use it!).
I hope I've helped,
Nuno Lopes