RE: Ip-to-country

From: Date: Tue, 06 May 2003 01:46:17 +0000
Subject: RE: Ip-to-country
References: 1  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17349@lists.php.net to get a copy of this message
Okay now I'm really going to bed. Works for me using commandline CURL it's not tuning me that it can't find my country: <blockquote> We detected that you are from <b>South Africa</b></blockquote> Rasmus if you remove the cookie you should find that the detection works better. Prob putting a lower ttl on the cookie would not be a bad idea? Regards --jm > -----Original Message----- > From: Jacques Marneweck [mailto:jacques@ataris.co.za] > Sent: Tuesday, May 06, 2003 2:21 AM > To: Jim Winstead; Rasmus Lerdorf > Cc: Sandeep S.; Divyank Turakhia; 'Gabor Hojtsy'; webmaster@php.net; > systems@php.net > Subject: RE: Ip-to-country > > > Hi Jim, > > I have a fix for the proxy stuff. It seems to work in my test > environment, will unleash it in a bit into cvs. > > Basically it ignores IP's defined in RFC 1918 namely: > - 10.0.0.0/8 > - 172.16.0.0/12 > - 192.168.0.0/16 > > root@mimbari:~/directi# php -q locateperson.php > --i-want-extra-debugging > "10.0.10.1, 172.16.22.22, 192.168.0.199, 192.168.2.2, 192.168.253.13, > 196.7.86.77, 196.7.86.78, 196.30.76.3" "207.126.232.175" > Array > ( > [0] => 10.0.10.1 > [1] => 172.16.22.22 > [2] => 192.168.0.199 > [3] => 192.168.2.2 > [4] => 192.168.253.14 > [5] => 196.7.86.77 > [6] => 196.7.86.78 > [7] => 196.30.76.3 > ) > skipping 10.0.10.1 > skipping 172.16.22.22 > skipping 192.168.0.199 > skipping 192.168.2.2 > skipping 192.168.253.14 > lookingup 196.7.86.77 > [directi] Person is located in South Africa > > Works nicely with my php CLI testing tools. > > I'll commit it shortly. > > Regards > --jm > > > -----Original Message----- > > From: Jim Winstead [mailto:jimw@apache.org] > > Sent: Tuesday, May 06, 2003 1:06 AM > > To: Rasmus Lerdorf > > Cc: Sandeep S.; Divyank Turakhia; 'Gabor Hojtsy'; webmaster@php.net; > > systems@php.net > > Subject: Re: Ip-to-country > > > > > > 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 > > > >

« previous php.mirrors (#17349) next »