Welcome Guest, Not a member yet? Register   Sign In
losing session data
#11

[eluser]InsiteFX[/eluser]
His problem with the CI session class is most likly
the size of the user_data field, which of course you
can change.

See below:
Code:
-- --------------------------------------------------------------

--
-- Table structure for CodeIgniter cisessions.
--
DROP TABLE IF EXISTS `ci_sessions`;

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`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;

--  `user_data` text       DEFAULT '' NOT NULL, COMMENT TEXT column of 65535 (2^16 - 1) characters
--  `user_data` mediumtext DEFAULT '' NOT NULL, COMMENT TEST column of 16777215 (2^24 - 1) characters
--  `user_data` longtext   DEFAULT '' NOT NULL, COMMENT TEXT column of 4294967295 (2^32 - 1) characters

I do think that the longtext would be over doing it!

InsiteFX
#12

[eluser]St0neyx[/eluser]
I checked some stuff again and again and your both right, the session is to big for the db therefor data is lost.
Now the database field is mediumtext (should be enough) and the data inserted is serialized.

I miss understood the code, thought that the session still ended up in the cookie, missed this part
Code:
foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
{
    unset($custom_userdata[$val]);
    $cookie_userdata[$val] = $this->userdata[$val];
}

After the fix of the db field and using the database through normal session method it all work fine Smile
#13

[eluser]InsiteFX[/eluser]
Glad to here that.

The user_data field text sometimes gets over filled and will truncate the data!

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB