[eluser]cideveloper[/eluser]
Hey All
So this is not really a question, more of an observation I made yesterday. First time I noticed this. When using CI session and a DB to store data with the following info obtained from the docs.
Code:
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(50) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text DEFAULT '' NOT NULL,
PRIMARY KEY (session_id)
);
and
Code:
sess_match_useragent = TRUE
Every time I went to any page a new session was created and it was driving me crazy. Never had this problem before.
Solution: user_agent field in DB needs to be a larger varchar. When CI inserted my user_agent it was being truncated due to the small size of the field. Then when Session queries to see if their is an existing session the user agents dont match.
Code:
SELECT *
FROM (`ci_sessions`)
WHERE `session_id` = '0e90633d2901c711a6efd855c40729fd'
AND `user_agent` = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1'
my user agent was being stored as "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gec" due to size restrictions.
Anyone else have this problem and think maybe the docs should be changed to reflect
user_agent varchar(255) NOT NULL