Welcome Guest, Not a member yet? Register   Sign In
Persistent Session
#1

[eluser]iainco[/eluser]
Hey guys (first post) I'm new to codeigniter (but have studied the user guide)

I was just wondering if anyone else has came across the problem I seem to be having:

I'm using the default Session library with the latest CI release. Having set the the 'sess_expiration' var in config to zero I was hoping for persistent sessions (so that after logging in a user would still be logged in even after they close and open their browser again).

It works with IE7 but doesn't with FF2 (even though when clicking "show cookies" under privacy in options the ci_session cookie is there).

I think I may have a mistake in my code where I'm checking to see if there is a current valid session. I have added my own userdata element - simply the authorised users' e-mail address.

Code:
if($this->session->userdata('email'))
{
   redirect('/home/'); //Private homepage.
}
else
{
   redirect('/welcome/'); //Showing login form.
}

I think instead here I should be comparing the session id that is registered with cookie with the current session id? But then I'm confused as to why my current implementation works with IE but not FF.

*Scratches head*

I will do some more searching.

Thanks or any advice.

Iain
#2

[eluser]iainco[/eluser]
Ok it appears that it is working in Firefox as well. I forgot I have my Firefox set to delete all my browsing history on close, my own fault then!




Theme © iAndrew 2016 - Forum software by © MyBB