Welcome Guest, Not a member yet? Register   Sign In
Session database error
#1

Hello I've got a problem with my codeigniter 3 setup. When I log in on the site from IP x and then I'm trying to go to site from IP y I got an error message:

Code:
Error Number: 1062

Duplicate entry '----' for key 'PRIMARY'

INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('----', '----', 1440958363, '__ci_last_regenerate|i:1440958363;')

Filename: libraries/Session/drivers/Session_database_driver.php

Line Number: 220

My session config:

Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

And my database table:

Code:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
 `id` varchar(40) NOT NULL,
 `ip_address` varchar(45) NOT NULL,
 `timestamp` int(10) unsigned NOT NULL DEFAULT '0',
 `data` longblob NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `ci_sessions`
 ADD PRIMARY KEY (`id`),
 ADD UNIQUE KEY `ci_sessions_id_ip` (`id`,`ip_address`),
 ADD KEY `ci_sessions_timestamp` (`timestamp`);

Do you guys know how to fix this?
Reply
#2

Does it happen if you set the config sess_match_ip to FALSE?
Reply
Reply
#4

(08-31-2015, 03:20 PM)PaulD Wrote: Does it happen if you set the config sess_match_ip to FALSE?

No, if I disable this option it works right. But using match ip is safer right?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB