PHP expert |
|
<?php
function getLocation($ip)
{
$URL = "http://geoloc.daiguo.com/?ip=".$ip;
if($filehandle = fopen($URL,'r'))
{
ob_start();
fpassthru($filehandle);
$HTML = ob_get_contents();
ob_end_clean();
fclose($filehandle);
}
$aCountry = explode(';', $HTML);
if($aCountry[0] == '1') {
return $aCountry[1]; // 3= BELGIUM, 2= BEL, 1= BE, 0= STATUS
} else {
return 'IP not found.';
}
}
$sLocation = getLocation($_SERVER['REMOTE_ADDR']);
if($sLocation == "BE" || $sLocation == "NL") {
// hier je code voor be & nl
}
?>
<?php function getLocation($ip) { $URL = "http://geoloc.daiguo.com/?ip=".$ip; if($filehandle = fopen($URL,'r')) { } if($aCountry[0] == '1') { return $aCountry[1]; // 3= BELGIUM, 2= BEL, 1= BE, 0= STATUS } else { return 'IP not found.'; } } $sLocation = getLocation($_SERVER['REMOTE_ADDR']); if($sLocation == "BE" || $sLocation == "NL") { // hier je code voor be & nl } ?>
|