ip2c 1.0 (flatdb)

HOMEPAGE: http://hot-things.net

1. DESCRIPTION
2. HOW TO INSTALL
3. LICENSE

1. DESCRIPTION

ip2c 1.0 is an extremely fast PHP script in 3 modules which can determine which country an IP address belongs to, 
redirect to the proper page in a multilanguage site, display the name of a country, its national flag or both. 
MySQL database is not required. The HTML output produced by any of the modules is 100% XHTML1.1 compliant.
ip2c 1.0 is able to work with two freely downloadable CSV databases:

 http://www.maxmind.com (GeoIPCountryWhois.csv) 
 http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip

 http://ip-to-country.directi.com (ip-to-country.csv) 
 http://ip-to-country.directi.com/downloads/ip-to-country.csv.zip

The main idea is to decrease and split a large CSV database into small text files 
which can be opened by the PHP interpreter for a few miliseconds. Tools for converting/splitting are included.


2. HOW TO INSTALL

1) extract all files in an empty directory named: /ip2c or whatever you wish
2) CHMOD the directory /ip2c to 777 (*nix based systems only)
3) download a CSV database either from:
     http://www.maxmind.com (GeoIPCountryWhois.csv)
  or http://ip-to-country.directi.com (ip-to-country.csv)
4) extract the CSV database in the directory /ip2c 
   (note that GeoIPCountryWhois.csv is 4mB and you'll need 2mB additional space during converting)
5) run either 'convert_geoip.php' or 'convert_ip2c.php' depending on the database you have downloaded
6) if it's converted properly you'll see a link to split it into pieces. Click on the link.
7) when splitting is done delete the CSV database, run ip2c.php and enjoy

if you'd like to display a flag for each country you should find all flags as GIF or PNG images,
put them in a directory and set at the beginning of ip2c.php: 
a correct relative or absolute path for that directory, a proper extension, width and height for the images.
Flags must be called with the 2-letters country code:

us.gif or us.png - for USA
gb.gif or gb.png - for Great Britain 
fr.gif or fr.png - for France
ru.gif or ru.png - for Russia
etc

Flag images can be found here: http://ip-to-country.directi.com/book/print/90

---

if you own a multilanguage site and would like to redirect people to a proper language version
depending on their IP address you may use redirect.php (just rename it to 'index.php' or something).
Do not forget to set at the beginning of redirect.php a correct path to the directory with the flat db files and 
files/directories where visitors should be redirected.
Note that you must have a database already split into small text files (if ip2c.php worked properly everything is ok)!

---

if you'd like to display the national flag (country name or IP address) of each visitor just set anywhere in your PHP files:
<?php include "ip2c/ip2c.inc";?> and then set proper values for the variables at the beginning of ip2c.inc
Note that you must have a database already split into small text files (if ip2c.php worked properly everything is ok)!

Flag images can be found here: http://ip-to-country.directi.com/book/print/90


3. LICENSE

ip2c is distributed under a GNU General Public License (GPL): 
http://www.gnu.org/copyleft/gpl.html

