mudei o código para fazer o que você quer no exemplo.php <?php
include('ip_files/countries.php');
function iptocountry($ip) {
$numbers = preg_split( "/\./", $ip);
$numbers[0] =(int)$numbers[0];
include("ip_files/".$numbers[0].".php");
$code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
foreach($ranges as $key => $value){
if($key<=$code){
if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}
}
}
if ($two_letter_country_code==""){$two_letter_country_code="unkown";}
return $two_letter_country_code;
}
$IPaddress=$_SERVER['REMOTE_ADDR'];
//$IPaddress="186.205.6.60";
$two_letter_country_code=iptocountry($IPaddress);
$three_letter_country_code=$countries[ $two_letter_country_code][0];
$country_name=$countries[$two_letter_country_code][1];
$country_lang=$countries[$two_letter_country_code][2];
$country_lang_long=$countries[$two_letter_country_code][3];
if(!isset($country_lang)){
$country_lang="en";
$country_lang_long="en_US";
}
print "IP: $IPaddress<br>";
print "Two letters code: $two_letter_country_code<br>";
print "Three letters code: $three_letter_country_code<br>";
print "Country name: $country_name<br>";
print "Country language: $country_lang<br>";
print "Country language long: $country_lang_long<br>";
$pais = $country_name;
// To display flag
$file_to_check="flags/$two_letter_country_code.gif";
if (file_exists($file_to_check)){
$band = "<img src=".$file_to_check." width=\"30\" height=\"15\"><br>";
}else{
$band = "<img src=\"flags/noflag.gif\" width=\"30\" height=\"15\"><br>";
}
echo "Flag: ".$band;
?>
para funcionar corretamente você deve incluir os códigos de idioma que deseja usar para os países no arquivo /ip_files/countries.php
exemplo na linha do Brasil:
está assim:
"BR" => array("BRA","Brazil"),
inclua os idiomas
"BR" => array("BRA","Brazil","pt","pt_BR"), faça isso para os países que quiser especificar o idioma. os países que estiverem sem esses dados automaticamente receberão o idioma inglês dos USA se quizer baixar os arquivos modificados lá vai. http://www.mediafire.com/download.php?9wzwati1qenfs49 Abraços a todos! :rolleyes: