php - Destroy Session but keep flashdata -


I am using my CI 1.7.3 app for user management. Everything is working fine, but when the user logs out I am trying to set up flash_message to display The problem is that $ this-> Tank_th-> Logout (); Function destroys session I have modified the logout function to modify the logout function:

  function logout () {$ this- & gt; Delete_autologin (); // see http://codeigniter.com/forums/viewreply/662369/ due to the next line $ user_session_data = array ('user_id' = & gt; '', 'username' = & gt; '', 'status' = & Gt; ''); $ This- & gt; Ci- & gt; Session-> Set_userdata ($ user_session_data); $ This- & gt; Ci- & gt; Session-> Unset_userdata ($ user_session_data); }   

It was earlier

  function logout () {$ this-> Delete_autologin (); // see http://codeigniter.com/forums/viewreply/662369/ due to the next line $ $ - this- & gt; Ci- & gt; Session-> Set_userdata (array ('user_id' = & gt; '', 'username' => gt; '', 'status' =>);); $ This- & gt; Ci- & gt; Session-> Sess_destroy (); }   

In my controller

  function logout (if ($ this-> tank_auth-> is_logged_in ()) {// $ This- & gt; session-> set_flashdata ('status_message', $ this-> log-> logged in line ('auth_message_logged_out'); $ this-> tank_auth- & gt; Logout (); redirect ('');}   

}

If I type <$> $ this-> tank_auth-> logout (); function, the message shows the correctness. I'm sure this is a common session problem.

< P> If you set up flashdata while using a database After trying to call sess_destroy () , the only request, this will not work (because there is no session to add the flash data).

This problem To fix, $ this-> ci-> session-> sess_create (); after calling sess_destroy () . This is the only way to use flash data after sess_destroy () if you are re-creating the session before attempting to attach it to the data. Using the session in the database.

Comments