Skip to content

Commit

Permalink
IPv6 사용시 /48 이상 변경되면 세션을 유지하지 않도록 변경 (#1767)
Browse files Browse the repository at this point in the history
  • Loading branch information
kijin authored and bnu committed Aug 30, 2016
1 parent 5cf5e74 commit 7302f22
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/member/member.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,17 @@ function isLogged() {
{
return true;
}
elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{
// IPv6: require same /48
if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0)
{
return true;
}
}
else
{
// IPv4: require same /24
if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
{
return true;
Expand Down

0 comments on commit 7302f22

Please sign in to comment.