Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.2k views
in Q2A Core by
edited by

I am still wondering when createip is null.

function qa_remote_ip_address() is obviously creating the IP address by:

return @$_SERVER['REMOTE_ADDR'];

I think the function should be expanded by:

public function getRemoteIPAddress() {
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        return $_SERVER['HTTP_CLIENT_IP'];

    } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { 
        return $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    return $_SERVER['REMOTE_ADDR'];
}

From http://stackoverflow.com/a/19311275/1066234

To get the IP in all cases.


PS: Just stumbled over https://github.com/q2a/question2answer/pull/240 but there is no solution.

Basically: Why is the IP null?


*** Gosh, can you just add the "source" button to the ckeditor so we can edit/clean the html. Cannot get rid of this formatting here.
Q2A version: 1.7.4
by
edited by
Why I noticed this issue: http://www.question2answer.org/qa/51178/tip-prevent-anonymous-users-without-ip-to-answer-or-comment → "createip" is null in the database, but the anonymous guest was able to answer!

Is that an IPv6 issue? What is going on?

COALESCE(INET_ATON(#), 0)

if we set # e.g. "2a00:8640:1::224:36ff:feef:1d89" what is the result? NULL?

Could this be an issue? → http://stackoverflow.com/q/13682058/1066234
"Try using trim() before adding ip to parameters list."

----

I am quite sure that it is a problem with INET_ATON(#) because my linked code from above would not allow the user to answer (removes buttons) if the IP is null. However, he can answer, thus the IP is there but not saved to the database correctly!

Please log in or register to answer this question.

...