Re: Ip-to-country
| From: | Jim Winstead | Date: | Mon, 05 May 2003 23:05:57 +0000 |
| Subject: | Re: Ip-to-country | ||
| References: | 1 2 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-17344@lists.php.net to get a copy of this message | ||
On Mon, May 05, 2003 at 03:49:02PM -0700, Rasmus Lerdorf wrote:
> My request from the office looks like this:
>
> [ snip ]
> X-Forwarded-For: 207.126.232.175
so when the request hits the squid on php.net, it will get forwarded to
the back-end apache, and this header will end up looking like one of:
X-Forwarded-For: 207.126.232.175,22.22.22.22
X-Forwarded-For: 22.22.22.22,207.126.232.175
(where 22.22.22.22 is the remote address of your local proxy. i forget
the order which it ends up using.)
this confuses this line in ip-to-country.inc:
$ipnum = (float) sprintf("%u", ip2long($_SERVER['HTTP_X_FORWARDED_FOR']));
(it returns 4294967295, or 255.255.255.255.)
i ran into the same thing in implementing this with the geoip data. that
code needs to just pick out the correct ip address from an X-Forward-For
header that has more than one.
jim