RE: ip-to-country - summary

From: Date: Fri, 25 Apr 2003 19:39:50 +0000
Subject: RE: ip-to-country - summary
References: 1  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17075@lists.php.net to get a copy of this message
Hi, I was taking a peek at doing stuff kief stuff when doing a /get/file/from/mirror goodie we can open a connection to the remote server the user wants to pull the file from and check it the file exists read say 1024/2048 or however many bytes, check the status code. I do something similar with my implementation to Colin's works stuff and to a couple other sites that I use for work. This would add a slight 1 sec or so delay but it's prob worth it? Regards --jm > -----Original Message----- > From: Gabor Hojtsy [mailto:gabor@hojtsy.hu] > Sent: Friday, April 25, 2003 6:17 PM > To: Divyank Turakhia; php-mirrors@lists.php.net > Cc: jimw@php.net; imajes@php.net; 'James Cox' > Subject: Re: ip-to-country - summary > > > > ) We have no issue in using the Directi ip-to-country > database. No one > > seems to have any objection with this yet, so I am assuming > that we are > > going ahead with this. > > OK. > > > ) We are going to use the database initially for the following: > > ) To display events from the visitors country on top > > This will be handled differently (probably we will make the > events in the > user's country bold), due to caching reasons. I'll explain > this when we get > there... > > > ) To display the visitors country on top in the "mirror > sites" page > > ) To display the visitors country on top in the download pages > > Yep. > > > ) Automatic Redirection is something that we want to do once we have > > discussed solutions to tackle all the possible situations > that arise out > > of the same. There are quite a few "situations" :o) - so > this may take a > > little time. > > Well, whether we want it or not is not to be declared now. It > would be a nice > thing, but we cannot see correct methods to achive it. But it > is for later, > not our current focus... > > > ) The php website is going to download the ip-to-country > database from > > the directi website in the format that we all mutually come up with > > using a cron. This format is the exact format that the php website > > needs. > > Yep. > > > ) Distribution of the db to mirrors and related sites will happen > > through rsync > > Yep. > > > Our next step now is to start building the format of the db > by writing > > test scripts. Let me know if any one need any inputs from my end for > > this. > > Well, I was unable to come up with anything better, then my > indexable text > file idea. What we need with this format: > > - three fields: iprange from and to and three letter countrycode > - have all fields padded to a fixed length (actually only > the first two > are related, and they should be padded with zeros added to the > left to let PHP recognized them as numbers, if they need to act in > a comparision) > - no char to separate the fields. This is not needed because of the > fixed width nature of the data > - \n (one byte) linending > > This way, one record will be (2*ipnumber_length+3+1) bytes. > So we can build up > an index for the IP numbers. This would mean that we need to > define a step, > with which we index the IP list. So something like: > > $where_to_start_for_ip_search = array( > 0 => 0, > 10000 => 15, > 20000 => 23, > [...] > ); > > This is a mapping between where (at what record) to start to > search for an IP > above that number. Then we can fseek() to that position, as > we know the fixed > size of records. From there we can start a normal linear > search, that would > probably be sufficient. > > Then when we find the right range and country, we set it in a > cookie for the > user, so it stays there, and we won't need to find out the > country again. > > Divyank, I would like to ask you to create an output format > like this, so we > can start to write the script on our end to receive the file, > process it to > create the index, and deploy it to the mirror sites. Except > if anyone has any > objections to the above method, or can suggest a better one > ;) Don't be > afraid of suggesting anything revolutionary ;) > > Goba >

« previous php.mirrors (#17075) next »