mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-21 09:03:38 +02:00
- fix protection against session hijacking for IPv4; ti be done later for ipv6
git-svn-id: http://piwigo.org/svn/trunk@12119 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -94,13 +94,16 @@ function pwg_session_close()
|
||||
|
||||
function get_remote_addr_session_hash()
|
||||
{
|
||||
$separator = (FALSE === strpos($_SERVER['REMOTE_ADDR'],'.'))
|
||||
? ':'
|
||||
: '.'
|
||||
;
|
||||
|
||||
return substr(md5($_SERVER['REMOTE_ADDR']), 0, 4);
|
||||
if (strpos($_SERVER['REMOTE_ADDR'],':')===false)
|
||||
{//ipv4
|
||||
return vsprintf(
|
||||
"%02X%02X",
|
||||
explode('.',$_SERVER['REMOTE_ADDR'])
|
||||
);
|
||||
}
|
||||
return ''; //ipv6 not yet
|
||||
}
|
||||
|
||||
/**
|
||||
* this function returns
|
||||
* a string corresponding to the value of the variable save in the session
|
||||
|
||||
Reference in New Issue
Block a user