=inet_aton('$ip') "; // Executing above query $country_exec = mysql_query($country_query); // Fetching the record set into an array $ccode_array=mysql_fetch_array($country_exec); // getting the country code from the array $country_code=$ccode_array['country_code2']; // getting the country name from the array $country_name=$ccode_array['country_name']; //Traitement $retour1 = mysql_query("SELECT COUNT(*) AS nbrip FROM lang WHERE ip='$ip'"); $donnees1 = mysql_fetch_array($retour1); if ($donnees1['nbrip'] == "0") { if ($country_name == "FRANCE") { $lang = "fr"; } else { $lang = "en"; } mysql_query("INSERT INTO lang VALUES('','$ip','$lang')"); } else { $retour = mysql_query("SELECT * FROM lang WHERE ip='$ip'"); $donnees = mysql_fetch_array($retour); $lang = $donnees['lang']; } } else { $lang = $_GET['newlang']; mysql_query("UPDATE lang SET lang='$lang' WHERE ip='$ip'"); } ?>