Kopfschüttel Du wirst doch wohl mal ein paar dämliche echo's einbauen können!!!
PHP
<?php
function getCountry(){
echo "In getCountry<br>";
$intIp = $_SERVER['REMOTE_ADDR'];
$strFallBack = 'DE';
$webSrv1 = 'http://geoip.wtanaka.com/cc/';
$webSrv2 = 'http://freegeoip.net/xml/';
$webSrv3 = 'http://ip2country.sourceforge.net/ip2c.php?format=XML';
// webservice 1 probieren $webSrv1
$strCountryIso = file_get_contents($webSrv1.$intIp);
echo "$strCountryIso<br>";
if(strtoupper($strCountryIso) == 'ZZ'){
// webservice 2 probieren $webSrv2
$objCountryIsoXml = simplexml_load_file($webSrv2.$intIp);
if($objCountryIsoXml->CountryCode == 'RD'){
// webservice 3 probieren $webSrv3
$objCountryIsoXml = simplexml_load_file($webSrv3);
if($objCountryIsoXml->country_code != 'RD'){
return strtoupper($objCountryIsoXml->country_code);
}else{
//hier angekommen failen alle 3 services
return $strFallBack;
}
}else{
return strtoupper($objCountryIsoXml->CountryCode);
}
}else{
return strtoupper($strCountryIso);
}
}
//Oben ist das Skript von synaptic von www.forum-hilfe.de - Stand 10.07.2012
$arrAllowed = array('DE','CH','ES','IT','LU','BE','SE','PL','CZ','HU','NO','LV','JP','MT','RO','RU','UA','GR','CY','BG','DK','US','CA','EE');
$strIsoCountry = getCountry();
echo "$strIsoCountry<br/>";
if (in_array($strIsoCountry, $arrAllowed))
{
echo "in_array<br>";
if ($strIsoCountry == 'DE')
{
// do nothing
}
elseif ($strIsoCountry == 'CH')
{
// do nothing
}
elseif ($strIsoCountry == 'ES')
{
// do nothing
}
elseif ($strIsoCountry == 'IT')
{
// do nothing
}
elseif ($strIsoCountry == 'LU')
{
// do nothing
}
elseif ($strIsoCountry == 'BE')
{
// do nothing
}
elseif ($strIsoCountry == 'SE')
{
// do nothing
}
elseif ($strIsoCountry == 'PL')
{
// do nothing
}
elseif ($strIsoCountry == 'CZ')
{
// do nothing
}
elseif ($strIsoCountry == 'HU')
{
// do nothing
}
elseif ($strIsoCountry == 'NO')
{
// do nothing
}
elseif ($strIsoCountry == 'LV')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'MT')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'RO')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'RU')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'UA')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'JP')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'CY')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'BG')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'DK')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'GR')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'US')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'CA')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
elseif ($strIsoCountry == 'EE')
{
header("Location: http://www.testdomain1234.de/page2.php");
exit;
}
}
else
{
echo "Im else-Zweig";
header("Location: http://www.testdomain1234.de/page5.php");
exit;
}
?>
Alles anzeigen
UNGLAUBLICH!!!!