I am sorry if I am asking a question that is already asked. After reading all the previous questions I still cannot find the solution of my issue. All I want is to remove the user session in ci_sessions table after the user has logged out as it is removing in the browser. Up to now I still cannot do it. As a result the ci_sessions table is getting bigger and bigger each time a user logs in.
Please help me know how to prevent the terrible increasement of the ci_sessions table by removing the user sessions each time he logs out or close his browser.
Version used : 3.1.5
1- config.php
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
2- controller
//login function
public function login()
{
$data = array(
'admin_id'=>$id,
'admin_name' =>$name,
'admin_perfil'=>$perfil,
'is_logged_in' => true
);
$this->session->set_userdata($data);
}
// log out
public function admin_logout()
{
$array_items = array(
'admin_name',
'admin_password',
'admin_perfil',
'admin_id',
'is_logged_in',
);
$this->session->sess_destroy();
$this->session->unset_userdata($array_items);
}