I'm using Codeigniter 2.2.0, trying to set my session in order to destroy session when a browser is closed. In my application/config/config.php
, I have set
$config['sess_use_database'] = TRUE;
$config['sess_expire_on_close'] = TRUE;
but it doesn't work. The session that stored in database is not destroy. I try to do this:
$this->session->set_userdata(array('user'=>'user1','login'=>TRUE));
and the session is stored in database with serialize user_data. And then I close the browser, and open the browser again, and run the same code above. Because the first session is not deleted from table, now I got 2 record in the session table with the same value in user_data column, but different session_id value. All I want is the first session must be destroyed and also deleted from database.
How can I fix this problem? Any suggestion?