CodeIgniter Forums
CI session and session ID - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: CI session and session ID (/showthread.php?tid=28229)



CI session and session ID - El Forum - 03-05-2010

[eluser]haXis[/eluser]
Hello,

I have a cart database table with session column which represent the CI session_id.

My question is - is there any way how to recognize that the session_id changed?

Debug session action:
Code:
SELECT *
FROM (`tc_ci_sessions`)
WHERE `session_id` = '99c86bd7597f7e463750ab94dbadb9dc'
AND `user_agent` = 'Opera/9.80 (Windows NT 6.1; U; cs) Presto/2.5.22 V'  

UPDATE `tc_ci_sessions` SET `last_activity` = 1267785550, `session_id` = 'd99c65b60773945ee125bd112e84903a' WHERE session_id = '99c86bd7597f7e463750ab94dbadb9dc'


Without changing the session ID in a cart I loose him and I dont want that before 7200 seconds.


CI session and session ID - El Forum - 03-05-2010

[eluser]haXis[/eluser]
I did a little research in code and I think the best solution is add an extra db query in the Session library.

After
Code:
$this->CI->db->query($this->CI->db->update_string($this->sess_table_name, array('last_activity' => $this->now, 'session_id' => $new_sessid), array('session_id' => $old_sessid)));

Add
Code:
$this->CI->db->query($this->CI->db->update_string('my_table', array('session_id' => $new_sessid), array('session_id' => $old_sessid)));

Hope that helps anyone else with similar problems.

Another suggestions are welcomed.