CodeIgniter Forums
Problem with session - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem with session (/showthread.php?tid=75504)



Problem with session - flownie - 02-13-2020

Hello

In my project I am saving CodeIgniter session data in a database. I am also using Ion Auth. I have a dynamic database connection, where I need to store the name of the client database in session. The Ion Auth connects to the correct database using this session value.

However, on the logout page, I have this code:

Code:
$this->ion_auth->logout();

The problem is:
Sometimes I lose all session data because $this->session->sess_destroy(); which is also called in the logout function is quicker and deletes all data in the database before I can get the needed session value with another query.

So simply put: I need the session data on the logout page and need to call $this->session->sess_destroy(); at the same time. But if the query for the sess_destroy is faster, I cant get the data. Is there a solution for this?

Thanks for your help.

Marc