where is field for session data in database |
[eluser]section31[/eluser]
I was looking at CI's session library and I don't see a field in the table structure to put the serialized array data in there. Code: CREATE TABLE IF NOT EXISTS `ci_sessions` ( Correct me if I'm wrong, but I thought the whole reason for using a database as opposed to a cookie is for storing the actual session data into the database? Also, if I wanted to use php's native sessions, where would be the best place to call session_start() if I want it used throughout the site.
[eluser]sophistry[/eluser]
i think you might be expecting CI sessions class to store the session data actually in the db table ci_sessions? as you have astutely observed, it does not do that. session ids are managed through the db and the data is serialized and stored in cookies using the sess_write() function of the Session class: Code: /** best place to call sessions_start()? i would think index.php... but i have never done that. i recall that the wiki hosts some alternative session libraries... cheers.
[eluser]section31[/eluser]
Thanks for the reply. I don't see any benefits of using a database if the real data isn't stored in there. Why was this not developed into the library?
[eluser]Colin Williams[/eluser]
Grab the DB_Session Library from the Wiki. It does exactly what you're thinking. We can spend 5 pages of thread discussing whether or not it should be (have been) in CI if you want, but it's not. The contributed library works fantastically.
[eluser]beemr[/eluser]
If you guys are operating from the svn, 1.6.4 now writes userdata to the ci_sessions table instead of the cookie. |
Welcome Guest, Not a member yet? Register Sign In |