mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge branch 'ticket/bantu/9091' into develop-olympus
* ticket/bantu/9091: [ticket/9091] Extract IPv4 address from addresses mapped into IPv6.
This commit is contained in:
commit
41245f9f7a
3 changed files with 13 additions and 0 deletions
|
@ -285,6 +285,17 @@ class session
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quick check for IPv4-mapped address in IPv6
|
||||||
|
if (stripos($ip, '::ffff:') === 0)
|
||||||
|
{
|
||||||
|
$ipv4 = substr($ip, 7);
|
||||||
|
|
||||||
|
if (preg_match(get_preg_expression('ipv4'), $ipv4))
|
||||||
|
{
|
||||||
|
$ip = $ipv4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use the last in chain
|
// Use the last in chain
|
||||||
$this->ip = $ip;
|
$this->ip = $ip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
|
||||||
$user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
|
$user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
|
||||||
|
$user->ip = (stripos($user->ip, '::ffff:') === 0) ? substr($user->ip, 7) : $user->ip;
|
||||||
|
|
||||||
$sql = "SELECT config_value
|
$sql = "SELECT config_value
|
||||||
FROM " . CONFIG_TABLE . "
|
FROM " . CONFIG_TABLE . "
|
||||||
|
|
|
@ -1236,6 +1236,7 @@ class install_install extends module
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
|
|
||||||
$user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
|
$user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
|
||||||
|
$user_ip = (stripos($user_ip, '::ffff:') === 0) ? substr($user_ip, 7) : $user_ip;
|
||||||
|
|
||||||
if ($data['script_path'] !== '/')
|
if ($data['script_path'] !== '/')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue