Bayraklar PHP kullanarak görüntüleme değil

0 Cevap

Ben kullanıcının IP adresine dayalı bir ülke bayrağı göstermek için çalışıyorum. Daha önce, ben gayet iyi çalışıyordu vardı, ama ben yanlışlıkla yanlış bir şey yaptığını düşünüyor. Ayıklama saat sonra, ben hataya neyin neden olduğunu bulmak için görünmüyor olabilir. Bu hataları atma değil, ama onun sadece herhangi bir bayrak veya 'eko' ifadeleri herhangi bir görüntüleme değil. Kimse herhangi bir tavsiye var mı? Kod aşağıda şimdiden teşekkürler olduğunu.

function iptocountry($ip) {  
   $numbers = preg_split( "/\./", $ip);  
   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="unknown";}  
return $two_letter_country_code;  
$IPaddress=$_SERVER['REMOTE_ADDR'];  
$two_letter_country_code=iptocountry($IPaddress);  

include("ip_files/countries.php");  
$three_letter_country_code=$countries[ $two_letter_country_code][0];  
$country_name=$countries[$two_letter_country_code][1];  

echo "Two letters code: $two_letter_country_code<br>";  
echo "Three letters code: $three_letter_country_code<br>";  
echo "Country name: $country_name<br>";  

// To display flag  
$file_to_check="flags/$two_letter_country_code.gif";  
if (file_exists($file_to_check)){  
            echo `"<img src=$file_to_check width=30 height=15><br>"`;  
            }else{  
            echo `"<img src=flags/noflag.gif width=30 height=15><br>"`;  
            }  


}  
?>  

0 Cevap