note 22194 deleted from function.session-set-save-handler by drak

From: Date: Sun, 11 Mar 2012 02:18:46 +0000
Subject: note 22194 deleted from function.session-set-save-handler by drak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186582@lists.php.net to get a copy of this message
Note Submitter: steve at saturn5 dot com ---- if you want to call session_start again after session_destroy, you have to call session_set_save_handler a second time. otherwise the session module doesn't know about all the nice functions you defined earlier because it has been destroyed. example: <?php # session handlers functions are defined # somewhere else session_set_save_handler ("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); session_start(); # do some stuff ... session_destroy(); # call this again, because session_destroy # destroys more than just the session. session_set_save_handler ("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); session_start(); # ... ?> we need to call session_start() twice in our login script to prevent multiple logins. i tore my hair out over this one. hope this helps someone else. :)

« previous php.notes (#186582) next »