spacer spacer

simple country lookup script using the database

here's an easy function to look up the country of a website visitor (ip adress) using the free database from

function haxGetCountryByIp(){




$qry="SELECT `name` FROM `countries`, ip4_".$ip1." WHERE `b`='".$ip2."' AND `c`='".$ip3."' AND".$ip1.".country"; $get=mysql_db_query("NAMEOFYOURHOSTIPINFODATABASE","$qry",$connect);

if($country) { return $country; }
else { return false; }


echo $country;
Vienna @ 20,7 °C [7,7m/s]
this site was rendered in 0.48819 seconds with a total # of 14 177 363 sites so far.
670012 of which came from registered users. Impressum @