Response to some questions from users

>If I use your code in PHP, how much of a delay will that be as compared to using a database?
>Please let me know.
>Thank you !

The system used for country identification will work very fast in most cases.

Lets consider an ip like this: AAA.BBB.CCC.DDD (AAA is a number, etc).

When IP addresses starting with AAA may belong to many different contries (file AAA.php is big), finding corresponding country will require more time. Fortunately, in most cases, the file searched is very small (
212 files from 255 are <5.000 bites). In those cases, this system will be faster than usage of a database.

>i manage 2 stores one is targeted towards UK and the other toward the rest of the world.
>i want a visitor from uk to be taken directly to the uk store
>and the others to be taken to the second store
>how would i be able to do that?

Try this way:


if ($two_letter_country_code=="UK"){

function iptocountry($ip) {   
    $numbers = preg_split( "/\./", $ip);   
    $code=($numbers[0] * 16777216) ($numbers[1] * 65536) ($numbers[2] * 256) ($numbers[3]);   
    foreach($ranges as $key => $value){
    if ($two_letter_country_code==""){$two_letter_country_code="unkown";}
    return $two_letter_country_code;

>But I cannot get the full name of the country.Which file do
>i have to edit?thanks in advance.
Try this two lines:

print $countries[$country];

2010@ All rights reserved. Contact