note 7848 deleted from session_destroy by ronabop

From: Date: Fri, 18 Aug 2000 03:33:34 +0000
Subject: note 7848 deleted from session_destroy by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-2283@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?

« previous php.notes (#2283) next »