Welcome Guest, Not a member yet? Register   Sign In
How to implement "Remember me" on login system
#1

[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.
#2

[eluser]cideveloper[/eluser]
Code:
$config['sess_expiration'] = 1209600;

in application/config/config.php
#3

[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?
#4

[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è
#5

[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
#6

[eluser]Massimiliano Marini[/eluser]
Hi Cristian,

[quote author="Cristian Gilè" date="1295114949"]
Take a look at how ion_auth implements it.
Cristian Gilè[/quote]

Ion_auth implement a remember me without an expire date.
#7

[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




Theme © iAndrew 2016 - Forum software by © MyBB