note 7848 added to session_destroy
| From: | sparc at email dot com | Date: | Thu, 17 Aug 2000 02:56:19 +0000 |
| Subject: | note 7848 added to session_destroy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1999@lists.php.net to get a copy of this message | ||
Seems like gc doesn't work properly when we use session_set_save_handler() with mysql. My mysql
log shows that the function is never called even with the proper setting in php.ini.
To cleanly kill a session when using session_set_save_handler, I've inserted the code
contrib'ed by ssross@uswest.net into the close() function and it works wonderful!
-- snippet --
function sess_mysql_destroy($sess_id) {
// Delete from the MySQL table all data for the session $sess_id
$result = mysql_db_query($db_name, "DELETE FROM ".$db_table." WHERE id =
'$sess_id'") or die (mysql_error());
// Destroy the client cookie to ensure the session is thoroughly destroyed
$p = session_get_cookie_params();
setcookie(session_name(), "", 0, $p["path"], $p["domain"]);
return(true);
}
-- end snippet --
I'll post the full mysql session code once the gc problem is resolved. Anyone?
http://www.php.net/manual/function.session-destroy.php