get correct User IP when has proxy

RT, we should match all pattern and use the last IP string as user IP.
This commit is contained in:
罗光盛 2017-03-11 23:59:56 +08:00 committed by GitHub
parent 29c9d8dc7d
commit aa3ae32a94

View File

@ -266,8 +266,8 @@ class UsersProcessor extends ClientSideProcessor implements AuthenticationManage
);
// Get user ip
if (preg_match("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $thread->remote, $matches) != 0) {
$user_ip = $matches[1];
if (preg_match_all("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $thread->remote, $matches) != 0) {
$user_ip = end($matches[1]);
} else {
$user_ip = false;
}