Reputation: 160
I have read the codeigniter document about session. but i still don't understand why they implement accessing session in database?
Any comments would be appreciated :)
Upvotes: 2
Views: 138
Reputation:
On codeigniter 3 you do not need to store sessions in database you can do it with out or use files
config.php starting from line 358
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 1440;
$config['sess_save_path'] = FCPATH . 'application/somefolder';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
Upvotes: 0
Reputation: 38584
There is no big deal with it. It means there is no any Security Reason for it
Main purpose of this is store user logins, and managing those.
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
PRIMARY KEY (id),
KEY `ci_sessions_timestamp` (`timestamp`)
);
Ex :timestamp
will gather the user logging time. So you can get detail about how many time user log in to site
Codeigniter Store Session
why is it good save session in database
Upvotes: 1