Code Igniter keeps losing my session ID |
I've posted this question on Stack Overflow - I'm going to cover my bases and post it here as well.
In my attempts to store session information in Code Igniter I am running into a pretty frustrating problem. Disclaimer - I am still quite green with both PHP and CI so please be kind... Another source of assistance has given me This code to test and it works fine with the following configuration - Code: $config['sess_driver'] = 'database'; Please note - this works fine. The database stores the values in the simple test and they are loaded again when the "web page" is reloaded. When I say that this 'works', what I mean is that when I run it, I get the following - When I terminate and relaunch I get the following - To me this says that the session data and database information is working as it should be, and there was much rejoicing. What does go wrong is when I attempt to log in. The session information is... 'lost' or something somehow and I can't figure out why that is happening. This is the chain of execution as best as I can trace it - Within the `routes.php` I have the following - Code: $route['default_controller'] = 'Main/view'; Within the `Main` class `view` method I have the following - Code: $this->load->model('User_Model', 'User'); The User_Model class definition and constructor - Code: CLASS User_Model EXTENDS MY_Model{ MY_Model definition and constructor - Code: CLASS MY_Model EXTENDS CI_Model{ The next few lines within the `Main` class `view` method - Code: $this->load->library('Form_validation'); Main getIP Function - Code: private function getIP(){ User_Model login function - Code: public FUNCTION login($userName, $password, $IP){ Now we return to the `Main` `view` method execution where we left off - Code: } ELSE { The User staleRow() function is actually inherited from the `MY_Model` class - Code: /** And then we have the Admin class definition and constructor - Code: CLASS Admin EXTENDS CI_Controller{ The Admin class is wherein the problem lies - for reasons beyond what my limited experience permits me to comprehend, when it reaches this point, the session data is not present - Please see the following pictoral evidence - This is the session variable within the `Main` class after the line `$this->session->set_userdata($this->User->staleRow());` is called. This is the session variable within the `Admin` class after the `PARENT::__construct();` method is called - I'm sure it's something I'm not doing correctly. Why is the session data not being loaded into the Admin class controller? EDIT 1 ------ Please know that I am running Code Igniter version 3.0.1 Below it was suggested I check the Cookie ID in a couple of places - this was the result: After the 'login' button was clicked - From this I can see the Cookie ID within the array (QATime = some obscenely long integer value)) After the `redirect('Admin');` call, this value is no longer present - I understand the function of this ID is to help find session data, so it makes perfect sense to me that the session data is lost because this ID is not being kept. So why is the Cookie ID being lost? |
Messages In This Thread |
Code Igniter keeps losing my session ID - by Geoclasm - 09-15-2015, 10:46 PM
RE: Code Igniter keeps losing my session ID - by mwhitney - 09-16-2015, 09:30 AM
RE: Code Igniter keeps losing my session ID - by Geoclasm - 09-16-2015, 05:22 PM
RE: Code Igniter keeps losing my session ID - by mwhitney - 09-17-2015, 07:02 AM
RE: Code Igniter keeps losing my session ID - by PaulD - 09-17-2015, 06:49 AM
|