note 58609 deleted from function.session-set-save-handler by danbrown
| From: | danbrown@php.net | Date: | Sun, 23 Jan 2011 16:17:59 +0000 |
| Subject: | note 58609 deleted from function.session-set-save-handler by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176042@lists.php.net to get a copy of this message | ||
Note Submitter: frank at ethisoft dot nl
----
REPLY TO >>>>> Keamos at gmail dot com [ 23-Oct-2005 10:34 ]
I would like to mention that there is a major flaw in your implementation:
I'll explain:
look at the 1st line:
$sessionLifetime = get_cfg_var("session.gc_maxlifetime");
then look at the write function in short:
global $db, $sessionLifetime;
$expiry = time() + $sessionLifetime;
$sql = 'SELECT
expiry FROM ' . SESSIONS_TABLE . " WHERE
sessionid=$sessionid";
if(null === $sql)
{
$sql = 'INSERT INTO ' . SESSIONS_TABLE . " (sessionid,
expiry, value) VALUES ($sessionid, $expiry, $sessionData)";
}
else
{
$sql = 'UPDATE ' . SESSIONS_TABLE . " SET
expiry=$expiry, value=$sessionData WHERE
sessionid=$sessionid";
}
then look at the garbage function in short:
$sql = 'DELETE FROM ' . SESSIONS_TABLE . " WHERE expiry < $time";
if you look carefully you will see this in the write function:
$expiry = time() + $sessionLifetime;
and this in the garbage function:
'DELETE FROM ' . SESSIONS_TABLE . " WHERE expiry < $time";
to be short, your session will never be destroyed except when you explicitly call the destroy
function!
have a nice 1...