[ticket/9746] Adding calls to phpbb_ip_normalise() from session management.

PHPBB3-9746
This commit is contained in:
Andreas Fischer 2010-07-22 00:59:12 +02:00
parent 8032549a15
commit 6a32724400

View file

@ -279,6 +279,24 @@ class session
foreach ($ips as $ip) foreach ($ips as $ip)
{ {
if (function_exists('phpbb_ip_normalise'))
{
// Normalise IP address
$ip = phpbb_ip_normalise($ip);
if (empty($ip))
{
// IP address is invalid.
break;
}
// IP address is valid.
$this->ip = $ip;
// Skip legacy code.
continue;
}
// check IPv4 first, the IPv6 is hopefully only going to be used very seldomly // check IPv4 first, the IPv6 is hopefully only going to be used very seldomly
if (!empty($ip) && !preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip)) if (!empty($ip) && !preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip))
{ {