do not predicate the setting of the cookie on the presence of the cookie, but always set it to reset the timeout

This commit is contained in:
<bdauvergne@entrouvert.com> 1210673407 +0200 0001-01-01 00:00:00 +00:00
parent 94c1f7be1a
commit bfad734b77
1 changed files with 9 additions and 4 deletions

View File

@ -5,9 +5,15 @@ require_once('lassospkit_debug.inc.php');
class LassoSPKitSessionFile {
function setcookie($session, $timeout) {
static $done = 0;
if ($done == 0) {
$done = 1;
$LassoSPKitSessionFile_cookiename = 'lassospkit_file_' . LassoSPKitConfig::get('cookiename');
setcookie($LassoSPKitSessionFile_cookiename, $session->id, time()+$timeout, '/');
}
}
function retrieve($session, $timeout) {
$LassoSPKitSessionFile_cookiename = 'lassospkit_file_' . LassoSPKitConfig::get('cookiename');
$content = null;
if (isset($_COOKIE[$LassoSPKitSessionFile_cookiename])) {
$session->id = $_COOKIE[$LassoSPKitSessionFile_cookiename];
@ -26,8 +32,8 @@ class LassoSPKitSessionFile {
}
if (! $content) {
$session->id = md5("lasso" . rand());
setcookie($LassoSPKitSessionFile_cookiename, $session->id, time()+3600, '/');
}
LassoSPKitSessionFile::setcookie($session, $timeout);
return $content;
}
function store($session, $content) {
@ -37,7 +43,6 @@ class LassoSPKitSessionFile {
lassospkit_errlog("cannot write into " . lassospkit_datadir() . "/cookie_session_" . $session->id);
}
}
}
function delete($session) {
$filepath = lassospkit_datadir() . "/cookie_session_" . $session->id;