Reputation:
One simple question. In the documentation it says the default time before the session expires is two hours. What I would like to know is if this time is extended by the time the user has been active on the page or is it just set?
Basicaly what I would like to know is if when I stay active for two hours straight would I still loose al the session data?
I'm just worried that some of my functions won't work after the two hours even if the user is still active. Should I just log the user out after the session expires?
Upvotes: 0
Views: 817
Reputation: 3457
Basicaly what I would like to know is if when I stay active for two hours straight would I still loose al the session data?
No, you won't.
CodeIgniter's session stores the time of the most recent activity of the user: $session['last_activity']
.
The session will expire if there hasn't been any activity for the duration of the session expiration time since the user's last activity. It will not expire if the expiration period has passed since the session has started, but there has been more recent activity by the user.
system/libraries/Session.php
:
if (($session['last_activity'] + $this->sess_expiration) < $this->now)
{
$this->sess_destroy();
return FALSE;
}
Upvotes: 1