CodeIgniter Forums

Full Version: Session expire on closing browser and time limit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. new here,

I am using CI 3, PHP 5.6.
I am making a basic user login with session.
I want to have a strict login with session expire in 20 minutes, and if browser close then destroy user session.

I know can set $config['sess_expiration'] = 0 to set destroy session on browser close and expire session in 20 minutes by setting $config['sess_expiration'] to 1200,
but I can't do both at the same time.
for now, i set a last active variable on session and sess_expiration to 0, and time out if last action is not in the 20 minutes time frame.
Is there anyway to do this?

$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = ??0 or 1200??;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;