Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
500 views
in Q2A Core by
I'm not sure why this is, and not really sure when, but it's showing all the users are registered with the server IP address, not their actual ip address. What could be the cause of that?
Q2A version: 1.7.0

1 Answer

0 votes
by

I got the solution for this problem enlightened

all you have to do is to edit the qa-base.php you can find the file in: (qa/qa-include/qa-base.php)

and search for function qa_remote_ip_address()

and replace this lines 

{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
 return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
}

with this lines

{
    $ipaddress = '';
    if (getenv('HTTP_CLIENT_IP'))
        $ipaddress = getenv('HTTP_CLIENT_IP');
    else if(getenv('HTTP_X_FORWARDED_FOR'))
        $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
    else if(getenv('HTTP_X_FORWARDED'))
        $ipaddress = getenv('HTTP_X_FORWARDED');
    else if(getenv('HTTP_FORWARDED_FOR'))
        $ipaddress = getenv('HTTP_FORWARDED_FOR');
    else if(getenv('HTTP_FORWARDED'))
        $ipaddress = getenv('HTTP_FORWARDED');
    else if(getenv('REMOTE_ADDR'))
        $ipaddress = getenv('REMOTE_ADDR');
    else
        $ipaddress = 'UNKNOWN';
    return $ipaddress;
}

this code works fine with me smiley

...