Multiple Sessions and Logging Out [message #8] |
Fri, 14 April 2006 02:52 |
ljkbrost
Messages: 59 Registered: April 2006
|
Member |
|
|
I have read the article on the Client Clones and Server Sessions (http://www.tonymarston.net/php-mysql/client-clones.html) about the creation of multiple sessions for a single logon instance.
I have played with the creation of sessions and it works great. I think that there is a problem with the logout link though. When I click the logout link, I'm returned to the logon screen for that session and all of the session data is deleted. But... The other sessions still work. I think that the "logout" link should really be "end session" and the "logout" link should kill all of the sessions.
I have created a function called destroyAllSessions() - listed below - that gets called when clicking "logout" and altered the old logout code to get called when clicking "end session".
I tested this code by opening up multiple sessions and clicking logout in one of the sessions. When you attempt to navigate to any other page from the unlogged out sessions, they all return to the login screen saying you need to login.
I hope this change can be rolled into the framework.
Cheers,
Kyle Brost
----
// ************************************************************ ****************
function destroyAllSessions ($prefix='menu')
// create a new session name using $prefix + a number.
{
foreach($_COOKIE as $session_name => $session_id)
{
session_name($session_name);
$_SESSION = array();
setcookie(session_name(), '', time()-42000, '/');
session_destroy();
}
session_write_close();
return $session_name;
} // destroyAllSessions
|
|
|