Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi,

    We included the latest version of the plugin (3.3) where the improvement above has been integrated. We now have a new/further problem:

    Let’s get through the script

    1. $_SERVER[‘REMOTE_ADDR’]:
    1. Everything is ok. He finds my IP and for that IP there are geo informations in the GeoIP.dat

    2. $_SERVER[‘HTTP_CLIENT_IP’])
    Result is empty -> nothing changes

    3. $_SERVER[‘HTTP_X_FORWARDED_FOR’])
    The problem starts: the script finds out that “my IP” is a proxy-ip and get’s now my “real ip behind the proxy”.

    So why is that a problem?
    If HTTP_CLIENT_IP or HTTP_X_FORWARDED_FOR returns an IP without geiInformations $ip gets overwritten without success.

    For that I changed the script:

    private function getClientIP()
    {
    $ip = $_SERVER['REMOTE_ADDR'];
    if (!empty($_SERVER['HTTP_CLIENT_IP']) && strlen(geoip_country_code_by_addr($this->gi,$_SERVER['HTTP_CLIENT_IP'])) != 0 ) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && strlen(geoip_country_code_by_addr($this->gi,$_SERVER['HTTP_X_FORWARDED_FOR'])) != 0 ) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    $ips = explode(",", $ip);
    return $ips[0];
    }

    So what do you think?

Viewing 1 replies (of 1 total)