When I enter my credentials for my login program developed in Codeigniter the sessions don't seem to be saving in the ci_sessions table in the MySQL database.
Once the form is filled in, the session will be set in the controller.php (sample code below):
if ($this->form_validation->run()) {
$data = array(
'email' => $this->input->post('email'), // posting the email input field
'is_logged_in' => 1
);
$this->session->set_userdata($data);
redirect('main/members');
} else {
$this->load->view('login');
}
At the moment its outputting the following when executing:
Array
(
[__ci_last_regenerate] => 1440877455
[email] => [email protected]
[is_logged_in] => 1
)
The output is using the following code in view.php
print_r($this->session->all_userdata());
The array should be outputting something similar below but its not:
Array
(
[session_id] => dd7e0e2266da6481ef45faaa7e3c808b
[ip_address] => 127.0.0.1
[user_agent] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
[last_activity] => 1387619782
[user_data] =>
[username] => Jhon
[email] => [email protected]
)
config.php:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
autoload.php
$autoload['libraries'] = array('database', 'session', 'form_validation');
$autoload['drivers'] = array('session');
$autoload['helper'] = array('url', 'form', 'html', 'security');
I have checked the config.php to ensure everything is set correctly and referred to the manual on Codeigniters website but still no joy in solving the issue.
Any idea's as to why this is happening? OR Any possible solutions?
is_loggedandis_logged_inproperties. Where is set first one?