Skip to content

Commit

Permalink
feature 2783: ability to disable ip address in the session id
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@18850 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Nov 1, 2012
1 parent a715d83 commit 200f22e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/config_default.inc.php
Expand Up @@ -405,6 +405,10 @@
// session_length : time of validity for normal session, in seconds.
$conf['session_length'] = 3600;

// session_use_ip_address: avoid session hijacking by using a part of the IP
// address
$conf['session_use_ip_address'] = true;

// +-----------------------------------------------------------------------+
// | debug/performance |
// +-----------------------------------------------------------------------+
Expand Down
7 changes: 7 additions & 0 deletions include/functions_session.inc.php
Expand Up @@ -94,6 +94,13 @@ function pwg_session_close()

function get_remote_addr_session_hash()
{
global $conf;

if (!$conf['session_use_ip_address'])
{
return '';
}

if (strpos($_SERVER['REMOTE_ADDR'],':')===false)
{//ipv4
return vsprintf(
Expand Down

0 comments on commit 200f22e

Please sign in to comment.