![]() |
session destroy, not destroying session? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: session destroy, not destroying session? (/showthread.php?tid=15995) |
session destroy, not destroying session? - El Forum - 02-21-2009 [eluser]x_dde_x[/eluser] I know that I'm doing something wrong. I'm trying to kill an entire session, and effectively log a user out. However, my logout script doesn't seem to be working Code: function logout() If the session is destroyed, shouldn't the session_id echo be NULL? (for the record, this is how I'm setting the session information: Code: $userdata=array('session_id'=> md5($username), 'userid'=> $username); session destroy, not destroying session? - El Forum - 02-21-2009 [eluser]TheFuzzy0ne[/eluser] No. All it does is kills the users cookie, but the userdata will remain within the session class until the end of the current request. The session will be reinitialised on the next request, and there will be no userdata available. Basically, all it does is severs the link between the user and the server session, but the data still remains until the end of the request. If it's that much of an issue, you can do this: Code: $this->session->userdata = array(); session destroy, not destroying session? - El Forum - 02-21-2009 [eluser]TheFuzzy0ne[/eluser] ...Or you can extend and override the session class with something like this: ./system/application/libraries/MY_Session.php Code: <?php |