• Resolved ade11

    (@ade11)


    We ran into an issue with one of our servers. We believe in your LoadVisitorData() function, the $_SERVER variable ‘HTTP_X_FORWARD_FOR’ should be ‘HTTP_X_FORWARDED_FOR’ ?

    Also, some servers will use HTTP_CLIENT_IP. And some configurations will return a list of IP addresses. One of our senior developers submitted this snippet, which would solve all these problems;

    // Get the visitor IP
    $ip=$_SERVER['REMOTE_ADDR'];
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {               // check ip from share internet
    	$ip=$_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {   // to check ip is pass from proxy
    	$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    $ips = explode(",", $ip);
    $this->mIP=$ips[0];

    Please can this or similar be incorporated in your next release?

    Many thanks!

    http://wordpress.org/extend/plugins/visitor-country/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Visitor Country] Getting IP through proxy using HTTP_X_FORWARD_FOR’ is closed to new replies.