Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Free Geolocation script


TheKiller - 5:25 am on Dec 31, 2010 (gmt 0)


With this i can help ! lol

Click Here to Download the DataBase:
[ip2nation.com...]
Upload it to phpmyadmin or whatever


Create a .PHP File with this Script :


$server = ''; // MySQL hostname
$username = ''; // MySQL username
$password = ''; // MySQL password
$dbname = ''; // MySQL db name


$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$sql = 'SELECT
code
FROM
ip2nationCountries c,
ip2nation i
WHERE
i.ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
AND
c.code = i.country
ORDER BY
i.ip DESC
LIMIT 0,1';

list($countryName) = mysql_fetch_row(mysql_query($sql));

// Output Country Code
echo $countryName;

?>


And thats it

if you want the country code to have uppercase letters replace:

SELECT CODE With SELECT iso_code_2

And dont forget that the database has country codes ,country , country latitude and longitude .....


Thread source:: http://www.webmasterworld.com/php/4247606.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com