CodeIgniter Forums
Change session expiration after initialisation? - 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: Change session expiration after initialisation? (/showthread.php?tid=21699)



Change session expiration after initialisation? - El Forum - 08-18-2009

[eluser]AdamP[/eluser]
I have a problem with my authentification library. My work is based on this tutorial:

http://www.bramme.net/2008/07/auth-library-for-codeigniter-tutorial/

Everything works fine, but I would like to implement a "keep me logged in" function. That means that a session should not expire automaticaly after n minutes, but be alive for unlimited time (or set it to 1+ years).

This thread didn't help either: http://ellislab.com/forums/viewthread/114113/

Because at the time that a user logs in, the session is already set. The website is multilingual and the selected language is saved in a session. This is implemented with a pre_controller hook that set's the default language as soon as the website is loaded for the first time.

Is there a way to change the session exipration value?
Any help and solutions are welcome.

Adam


Change session expiration after initialisation? - El Forum - 08-18-2009

[eluser]Jondolar[/eluser]
You may want to use a separate cookie instead of a session cookie. You can then set the expiration of the cookie after you authenticate. If you use the session class, you need to configure a session timeout globally. You could set this to the maximum and then use data from the session to determine if the account should time out earlier (kind of backwards).


Change session expiration after initialisation? - El Forum - 08-18-2009

[eluser]AdamP[/eluser]
[quote author="Jondolar" date="1250645523"]You may want to use a separate cookie instead of a session cookie. You can then set the expiration of the cookie after you authenticate. If you use the session class, you need to configure a session timeout globally. You could set this to the maximum and then use data from the session to determine if the account should time out earlier (kind of backwards).[/quote]

I will take a look at this approach, thank you. So with a second cookie, I would store if the user wants a permanent login. And this cookie would also be valid after brower restart. Makes sense Smile