I changed the code to this and it worked.
Code:
error_reporting( -1 );ini_set( 'display_errors','On' );
function getUserIpAddr(){ 
    if (!empty($_SERVER['HTTP_CLIENT_IP'])){ 
        return $_SERVER['HTTP_CLIENT_IP']; 
    }else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ 
        $ite=explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); return str_replace(" ",'',$ite[0]); 
    }else{ 
        return $_SERVER['REMOTE_ADDR']; 
    } 
} 
$ucip=getUserIpAddr();
$response=@file_get_contents('http://www.netip.de/search?query='.$ucip);if (empty($response)){throw new InvalidArgumentException("Error contacting Geo-IP-Server");}$patterns=array();$patterns["IP"] = '#IP: (.*?)&nbsp;#i';$patterns["country"] = '#Country: (.*?)&nbsp;#i';$patterns["city"] = '#City: (.*?)<br#i';foreach ($patterns as $key => $pattern){$ipInfo[$key] = preg_match($pattern,$response,$value) && !empty($value[1]) ? $value[1] : 'not found';}
$uip=$ipInfo["IP"];$uco=$ipInfo["country"];$uci=$ipInfo["city"];$ipInfo=explode('-',$ipInfo["country"]);$ucs=$ipInfo[0];
mysql_query("UPDATE stats SET week=week+1,views=views+1 WHERE id='$uid'");
mysql_query("UPDATE sites SET `$ucs`=`$ucs`+1");
mysql_query("INSERT INTO viewers (id,ip,p,city) VALUES('$uid','$ucip','".$_POST['page']."','$uci')");
I found out what the error was with the help of error_reporting( -1 );ini_set( 'display_errors','On' );. Thanks to traq.