Forum Moderators: coopster
$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;
?>
<?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;
?>
<?php
$CountryCode = ((isset($_GET['Lang']) && !empty($_GET['Lang'])) ? strip_tags($_GET['Lang']) :'US');
if($CountryCode == 'US'){
include("UnitedStates.html");
}
elseif($CountryCode == 'UK'){
include("UnitedKingdom.html");
}
else{
include("RestOfTheWorld.php");
}
?>