Jump to content

Country Detection


dragonusthei

Recommended Posts

There are free databases. Look for Ip2Country they offer a database (cvs file) that you can use and do your queries against.

You need to find the numeric representation of the customers IP address via a formula.  I do it for my employer's website to show various product that is only legally allowed to use in their country.

If you can find the ip2country database, I can look and post my code for looking up the area based on their IP.
Link to comment
Share on other sites

Just google!
Here's one I found by [b]Googling[/b]:
http://www.brothersoft.com/web_author/site_management/maxmind_geolite_country_database_42917.html

I am sure there are better ones out there... (it has lots of IPs, but it didnt have mine for an example)

Orio.
Link to comment
Share on other sites

I'm assuming your using a mysql database, if so then open up your database in phpmyadmin and click import then click import from csv.  Or if if you want to do it from the command line:
[code]LOAD DATA INFILE 'filename.csv' replace INTO TABLE {tablename} FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (examplefield1,examplefield2,examplefield3);
[/code]
I belive that's right if I remember my SQL commands, someone correct me if I'm wrong, don't like giving bad info =).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.