mp3 guru

Geo Redirect / Umleitung via PHP

Geo Redirect / Umleitung via PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
function IPtoCountry($ip) 
{ 
    $sock = fsockopen("whois.ripe.net", 43); 
    fwrite($sock, $ip."\n"); 
    while (!feof($sock)) { 
        $info .= fgetc($sock); 
    } 
    fclose($sock); 
    preg_match("/country:[ ]+([A-Z]{2})\n/", $info, $match); 
    return $match[1]; 
} 
 
if(IPtoCountry($_SERVER['REMOTE_ADDR']) !== "DE" 
&& IPtoCountry($_SERVER['REMOTE_ADDR']) !== "NL" 
&& IPtoCountry($_SERVER['REMOTE_ADDR']) !== "LU" 
&& IPtoCountry($_SERVER['REMOTE_ADDR']) !== "BE" 
&& IPtoCountry($_SERVER['REMOTE_ADDR']) !== "AT" 
&& IPtoCountry($_SERVER['REMOTE_ADDR']) !== "CH")
 
{
      header("Location: https://diedesigner.net");
}

geo, PHP, redirect


Schreibe einen Kommentar