"limiting the size of a session-file which gets read to list the sessions, to prefent admin users being not able to log in because of a \"runaway\" session of any other user"

This commit is contained in:
Ralf Becker 2007-04-30 05:37:31 +00:00
parent d7eebb964a
commit 5224372bfc

View File

@ -214,8 +214,18 @@
{
return $values;
}
if (!($max_session_size = ini_get('memory_limit'))) $max_session_size = '16M';
switch(strtoupper(substr($max_session_size,-1)))
{
case 'M': $max_session_size *= 1024*1024; break;
case 'K': $max_session_size *= 1024; break;
}
$max_session_size /= 4; // use at max 1/4 of the memory_limit to read sessions, the others get ignored
while (($file = readdir($dir)))
{
if (filesize($path.'/'.$file) >= $max_session_size) continue;
if (substr($file,0,5) != 'sess_' || $session_cache[$file] === false)
{
continue;