user1884324
user1884324

Reputation: 703

codeigniter session config file

there are 2 values in the config file for codeigniter session which i do not fully understand and hope someone can enlighten me, thanks.

# the number of SECONDS you want the session to last.
# by default sessions last 7200 seconds (two hours).
# Set to zero for no expiration.
$config['sess_expiration'] = 7200;  

Q1) Will the application logout the user when the time(2 hrs after login) is up even though the user is still actively using the application?

# how many seconds between CI refreshing Session Information
$config['sess_time_to_update'] = 300;  

Q2) Does this value affect the (Q1) senario?

Upvotes: 0

Views: 3621

Answers (1)

Mark Cameron
Mark Cameron

Reputation: 2369

The $config['sess_expiration'] is how long it will take before the session expires if there is no activity by the user on the session. $config['sess_time_to_update'] will update the expiration time every 5 minutes while the user is actively using the session.

So if the user logs in, has an expiration of 2 hours, and navigates around the site for 30 minutes and then leaves the site, they will have 2 hours from that point to visit again without needing to log in. If they do visit in those 2 hours, the expiration time will be reset to 2 hours from that point. If they don't visit again, they'll need to login.

Therefor if they are using the session they will not be logged out after 2 hours.

Upvotes: 1

Related Questions