How to implement "Remember me" on login system |
[eluser]Massimiliano Marini[/eluser]
Hi all, I'm using the session library in my CI2 application, sessions are stored into the database. How can I set the session expire only after 2 weeks? I've searched into the forum but I've not found something clear and simple. Any help are much appreciated.
[eluser]cideveloper[/eluser]
Code: $config['sess_expiration'] = 1209600; in application/config/config.php
[eluser]Massimiliano Marini[/eluser]
[quote author="progr@mmer" date="1295074492"] Code: $config['sess_expiration'] = 1209600; in application/config/config.php[/quote] Ok, but this affect all the sessions, instead I want make it like a choice (checkbox in the login form). If user check the checkbox the session expire after two weeks else session expire when: Code: $config['sess_expiration'] = 1209600; Any help?
[eluser]Cristian Gilè[/eluser]
[quote author="sylpheed" date="1295114741"][quote author="progr@mmer" date="1295074492"] Code: $config['sess_expiration'] = 1209600; in application/config/config.php[/quote] Ok, but this affect all the sessions, instead I want make it like a choice (checkbox in the login form). If user check the checkbox the session expire after two weeks else session expire when: Code: $config['sess_expiration'] = 1209600; Any help?[/quote] Take a look at how ion_auth implements it. Cristian Gilè
[eluser]InsiteFX[/eluser]
For a Remember me function you need to create a cookie. In the cookie set a time limit on it. Then in your code load and check the cookie. InsiteFX
[eluser]Massimiliano Marini[/eluser]
Hi InsiteFX [quote author="InsiteFX" date="1295121681"]For a Remember me function you need to create a cookie. In the cookie set a time limit on it. Then in your code load and check the cookie. InsiteFX[/quote] Very helpfully Thanks |
Welcome Guest, Not a member yet? Register Sign In |