mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 05:20:30 +03:00
parent
a5320b07d7
commit
843a6e11ae
@ -581,7 +581,11 @@ function get_remote_host()
|
||||
$has_proxy = isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
&& $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR'];
|
||||
if ($has_proxy) {
|
||||
$ext_addr = $_SERVER['REMOTE_ADDR'] . ' (' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')';
|
||||
$count = 0;
|
||||
$ext_addr = preg_replace('/^([^,]+)(,\s.+)?/', '\\1', $_SERVER['HTTP_X_FORWARDED_FOR'], -1, $count);
|
||||
if ($count > 1) {
|
||||
$ext_addr = $ext_addr . ' (' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $ext_addr;
|
||||
|
@ -266,11 +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];
|
||||
} else {
|
||||
$user_ip = false;
|
||||
}
|
||||
$user_ip = preg_replace('/^(\S+)(\s.+)?/', '\\1', $thread->remote);
|
||||
$user_ip = filter_var($user_ip, FILTER_VALIDATE_IP);
|
||||
|
||||
// Get thread operartor name
|
||||
$next_agent = $thread->nextAgent != 0
|
||||
@ -438,11 +435,8 @@ class UsersProcessor extends ClientSideProcessor implements AuthenticationManage
|
||||
$user_agent = get_user_agent_version($details['user_agent']);
|
||||
|
||||
// Get user ip
|
||||
if (preg_match("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $details['remote_host'], $matches) != 0) {
|
||||
$user_ip = $matches[1];
|
||||
} else {
|
||||
$user_ip = false;
|
||||
}
|
||||
$user_ip = preg_replace('/^(\S+)(\s.+)?/', '\\1', $details['remote_host']);
|
||||
$user_ip = filter_var($user_ip, FILTER_VALIDATE_IP);
|
||||
|
||||
// Get invitation info
|
||||
$row['invited'] = ($row['invitationstate'] == Thread::INVITATION_WAIT);
|
||||
|
Loading…
Reference in New Issue
Block a user