CodeIgniter Forums
Session is not destroyed when the window is closed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Session is not destroyed when the window is closed (/showthread.php?tid=20920)



Session is not destroyed when the window is closed - El Forum - 07-25-2009

[eluser]Huji[/eluser]
Hi,

The typical behaviour we experience is that when we log into a web site which uses session variables for authentication, if we close the browser window and open it again, we have to log in again.

I created a simple site and used Simplelogin library for authentication. However, when I close the browser and open it again, I'm still logged in. I checked the code and as far as I understand it, Simplelogin is using CodeIgniter's built-in session functions to handle the authentication process:

Code:
$this->CI->session->set_userdata(array('logged_in' => true));

I can't figure why this is happening. Is it that CodeIgniter's built-in functions for session, are using cookies in a way that has this side effect? Or is it me missing something here?


Session is not destroyed when the window is closed - El Forum - 07-25-2009

[eluser]Ryuuzaki92[/eluser]
The cookie might have been set an expiry date. It no expiry date is given while setting the cookie, the cookie will be deleted after the user closes the browser.