$remote_addr = $_SERVER['REMOTE_ADDR'];
IP Number = A x (256*256*256) + B x (256*256) + C x 256 + D
MySQL :
SELECT name,c2 FROM iptocontry WHERE INET_ATON('$remote_addr') >= ipfrom
AND INET_ATON('$remote_addr') <= ipto
PHP :
$ip_number = sprintf("%u",ip2long($dotted_ip_address));
$dotted_ip_address = long2ip($ip_number);
¿¹½Ã :
$index_connect_db = mysql_connect($mysql_host, $mysql_user, $mysql_password);
$index_select_db = mysql_select_db($mysql_db, $index_connect_db);
$remote_addr = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT name,c2 FROM iptocontry WHERE INET_ATON('$remote_addr') >= ipfrom AND INET_ATON('$remote_addr') <= ipto";
$row = mysql_fetch_array(mysql_query($sql));
$from = "You are from <b>".$row['name']."</b> <img src='/world/".strtolower($row[c2]).".png' align='absmiddle'> and your IP Address is <b>".$remote_addr."</b>";
Nov
13
Tuesday