Trovin
2/7/2019 - 4:14 PM

Location(IP adress) redirect user

IN HOME PAGE TPL
================

Service to checked your geolocation at ip adress *
http://www.geoplugin.net

Go here to get your geolocation info *
http://www.geoplugin.net/xml.gp?ip=


    if (isset($_SERVER['HTTP_CLIENT_IP']))
    {
        $real_ip_adress = $_SERVER['HTTP_CLIENT_IP'];
    }

    if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
    {
        $real_ip_adress = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
        $real_ip_adress = $_SERVER['REMOTE_ADDR'];
    }

    $xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".$real_ip_adress);
    if($xml->geoplugin_countryCode != 'DE' || $xml->geoplugin_countryCode != 'CH')
    {
        echo('<script>window.location.replace("http://www.global.agomed.com")</script>');
    }