Welcome Guest, Not a member yet? Register   Sign In
Session expiration: does it get renewed on each request?
#1

[eluser]aidehua[/eluser]
In my config/config.php I have this:


Code:
$config['sess_expiration']        = 7200;

So my session will expire after 2 hours.

Question: is that 2 hours after the session is created? Or 2 hours after last activity/request?
#2

[eluser]richzilla[/eluser]
Reading through the session library (in system/libraries), this

Code:
// Is the session current?
if (($session['last_activity'] + $this->sess_expiration) < $this->now)
{
    $this->sess_destroy();
    return FALSE;
}

would suggest that the session expiry is the last activity + the session expiration time, so yes, 2 hours after the sessions last activity in your case.
#3

[eluser]aidehua[/eluser]
Thanks, Ricardino. 5-star answer Smile . I'm grateful.

(And sorry, it was kind of lazy/stupid of me not to think of looking in the session library.)

Oh, and thanks, CodeIgniter, too - that seems to be the right way to do it. It would be a bit mean to log someone out after 2 hours even if they had been busily requesting new pages every 5 minutes...




Theme © iAndrew 2016 - Forum software by © MyBB