I am new to codeigniter framework. I have a problem with session time out with pages. Right now I had enabled with the ip match ,user agent matching but doesn\'t work.
Finally i found the solution for the problem.
The following ways to increase or decrease the session time out. 1.
ini_set('session.gc_maxlifetime', 60);
config->config.php
$config['sess_expiration'] = ''; //in seconds.
2.
$config['sess_time_to_update'] = '' ;//in seconds (as same in sess_expiration seconds)
3.If you are checking in login controller and all controller for the session data as
$_SESSION['data'] == 'your login id or role or something
.this is not getting session expired the session datas.but we need to check the check with $this->session->
userdata('your id or data need to check')
and before once login successfull then need to
assign the value to the session as $this->session->set_userdata('your id or something');
while checking the session = $this->session->userdata()
is empty or zero need to session_destory()
and then need to redirect to your home page.
Another way to increase :
These two ways i had tried and i found the solution for the session time out.its working fine for me.
Thanks to all.
if you dont have ci_sessions table in your database, create it using the following script.
CREATE TABLE IF NOT EXISTS `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(120) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id),
KEY `last_activity_idx` (`last_activity`)
);
use $this->session->set_userdata($array);
to get session data. Then it should work properly