Everybody wants to keep track of who is visiting their site, who is commenting on their posts, who is using their products. One can do this by logging users IP address and tracking it to get Geo info. There are lots of online tool available online but they can not be used all time. Some of them provide these ip to location services, but all can not afford thier charges.
MaxMind provides both versions of this serivce, liscensed version of this ip to geo database and free database for those who can not afford the liscensed copy.
The free version is also pretty accurate and can be used to track down IP up to city level.
I have developed a class using the free version ip to city database, that I thought, will prove a help for others.
$ip = new IP("xxx.xxx.xxx.xxx");
$country = $ip->getCountryCode();
$city = $ip->getCity();
Please download the latest free geo datastructures (geoip.inc, geoipcity.inc, geoipregionvars.php) from here .
You can download the class Ip and support files from here.