Fix: limit to dolibarr session and current entity

This commit is contained in:
Regis Houssin 2009-09-15 15:37:48 +00:00
parent f8c8df1096
commit b301340102

View File

@ -496,6 +496,8 @@ function listOfSessions()
*/ */
function purgeSessions($mysessionid) function purgeSessions($mysessionid)
{ {
global $conf;
$arrayofSessions = array(); $arrayofSessions = array();
$sessPath = ini_get("session.save_path")."/"; $sessPath = ini_get("session.save_path")."/";
dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath); dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath);
@ -508,6 +510,10 @@ function purgeSessions($mysessionid)
{ {
$fullpath = $sessPath.$file; $fullpath = $sessPath.$file;
if(! @is_dir($fullpath)) if(! @is_dir($fullpath))
{
$sessValues = file_get_contents($fullpath); // get raw session data
if (eregi('dol_login',$sessValues) && eregi('dol_entity\|s:([0-9]+):"('.$conf->entity.')"',$sessValues)) // limit to dolibarr session and current entity
{ {
$tmp=split('_', $file); $tmp=split('_', $file);
$idsess=$tmp[1]; $idsess=$tmp[1];
@ -520,6 +526,7 @@ function purgeSessions($mysessionid)
} }
} }
} }
}
@closedir($dh); @closedir($dh);
if (! $error) return 1; if (! $error) return 1;