mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
- use /48 and /64 subnets for IPv6 matching [Bug #9538]
git-svn-id: file:///svn/phpbb/trunk@7561 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -3411,9 +3411,10 @@ function get_preg_expression($mode)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first 4 blocks of the specified IPv6 address and as many
|
||||
* as specified in the length paramater additional ones.
|
||||
* Returns the first block of the specified IPv6 address and as many additional
|
||||
* ones as specified in the length paramater.
|
||||
* If length is zero, then an empty string is returned.
|
||||
* If length is greater than 3 the complete IP will be returned
|
||||
*/
|
||||
function short_ipv6($ip, $length)
|
||||
{
|
||||
@@ -3432,7 +3433,10 @@ function short_ipv6($ip, $length)
|
||||
{
|
||||
$ip = '0000' . $ip;
|
||||
}
|
||||
$ip = implode(':', array_slice(explode(':', $ip), 0, 4 + $length));
|
||||
if ($length < 4)
|
||||
{
|
||||
$ip = implode(':', array_slice(explode(':', $ip), 0, 1 + $length));
|
||||
}
|
||||
|
||||
return $ip;
|
||||
}
|
||||
|
Reference in New Issue
Block a user