Codeigniter Session Data not available in other pages after login
- by jswat
So, I have set up a login page that verifies the user's credentials, and then sets codeigniter session data 'email' and 'is_logged_in' and a few other items. The first page after the login, the data is accessible. After that page, I can no longer access the session data. In fact, if I try reloading that first page, the session data is gone.
I have tried storing it in the database, storing it unencrypted (bad idea I know, but it was for troubleshooting), and storing it encrypted. I have autoloaded the session library in config.php.
Here's an example of the code I'm using to set the session data:
$data = array(
'email' => $this->input->post('username'),
'is_logged_in' => true
);
$this->session->set_userdata($data);
And to retrieve it, I'm using :
$this->session->userdata('email');
Or
$this->session->userdata('is_logged_in');
I've done lots of work with PHP and cookies, and sessions before, but this is my first project with Codeigniter and I'm perplexed.
Could it have something to do with directory issues? I have the login page and process controlled by a 'login' controller, and then it redirects to a 'site' controller.
Thanks for your help, and please let me know if I need to clarify anything.