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


TheKiller - 5:22 pm on Jan 4, 2011 (gmt 0)




<?php

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


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

$sql = 'SELECT
country_code
FROM
ip_group_country
WHERE
ip_start <=INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
ORDER BY
ip_start DESC
LIMIT 0,1';
list($CountryCode) = mysql_fetch_row(mysql_query($sql));

?>

<?
echo $CountryCode;
?>



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