От къде си?

Код:
<?php 
$var = file("http://api.hostip.info/get_html.php?ip=".$_SERVER["REMOTE_ADDR"]); 

$info1 = $var[0]; 
$info2 = $var[1]; 

echo $info1; 
echo "<br>"; 
echo $info2; 
?>


Код:
<?php 
if($_GET['ip']) 
{ 
$readfile =file_get_contents("http://ip2country.esymbian.info/host/".$_GET['ip'].".html" ,"r"); 
$filechunks = explode('<td class="rqhostlabel" width="15%"><b>Country</b></td>', $readfile); 
$filechunks1 = explode('<td class="myiplabel" ><b>Your i.p.</b></td>', $filechunks[1]); 
$readfile1=strip_tags($filechunks1[0]); 

echo $readfile1; 
} 
?>

Код:
<?php 
$ip = getip(); 
$country = GetCountry($ip); 
function getip(){ 
   if(getenv('HTTP_X_FORWARDED_FOR')){ 
      $ip = $_SERVER['REMOTE_ADDR']; 
      if(preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)){ 
         $ip2 = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10..*/', '/^224..*/', '/^240..*/'); 
         $ip = preg_replace($ip2, $ip, $ip3[1]); 
      } 
   } else { 
     $ip = $_SERVER['REMOTE_ADDR']; 
} 
     if ($ip == "") { $ip = "12.34.56.78"; } 
return $ip; 
} 
function GetCountry($ip) { 
    if ( $file = fopen("ip-to-country.csv","r") ) { 
       while ( $line = fgetcsv($file,1024,",") ) { 
       // $line[2] = country code 2 char, 
       // $line[3] = country code 3 char, if needed... 
    if ( ip2long($ip) >= $line[0] && ip2long($ip) <= $line[1] ) { 
    return $line[2]; 
    } 
  } 
} 
return false; 
} 
echo "Ти си от $country <img src='flags/$country.GIF'>"; 
?>
Download the latest IP-to-Country Database


http://humanaaa.hit.bg/upload/ip_to_country.rar
 

Back
Горе