Raccoon
Raccoon

Reputation: 1427

Keeping session alive

I'm programming a company website which has an admin page for controlling data. As I went through forums and user guides, I learned that codeigniter's session stays 5 mins and gets destroyed once it's created. I do not want this to happen when an admin is manipulating data :(

Should I keep writing 'session_start()' in the controllers belongs to admin pages to keep the session fresh and alive? :(

Upvotes: 1

Views: 1560

Answers (2)

Laurence
Laurence

Reputation: 60068

Why dont you just change your session config?

$config['sess_cookie_name']     = 'yoursite';
$config['sess_expiration']      = 7200;   <- make this longer
$config['sess_encrypt_cookie']  = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;   <- make this longer

Upvotes: 2

Raccoon
Raccoon

Reputation: 1427

I've been using autoload and never knew it calls session_start() for me :/

Upvotes: 1

Related Questions