Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
125 views
in Q2A Core by
hello i have issue on my ngix, and my all user show me same ip adress,

is there any config availabe to make them solved ?
Q2A version: Version 1.8.3
by
I have same problem to but I'm using apache2 server

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

...