skip to content

CodeIgniter session changes when using a database

August 21st, 2008

An oft-requested feature has been implemented in CodeIgniter’s session class.  If you use a database to store your session info, then all user data will now be in the database, rather then an encrypted cookie.  From the subversion repository’s changelog

Updated the Sessions class so that any custom data being saved gets stored to a database rather than the session cookie (assuming you are using a database to store session data), permitting much more data to be saved.

More details available in the manual.  Please read the svn upgrading instructions, as a new field needs to be added to the database for this.

This entry was made on August 21st, 2008 @ 6:51 and filed into CodeIgniter.

Comments

Sam wrote on August 21st, 2008 @ 6:40

That’s good.

Btw, why not separate session storage drivers like it’s done to database drivers?

This way we can get memcache sessions, file sessions etc.

Ihab wrote on August 21st, 2008 @ 9:18

Great Work

So I don’t have to use db_session library anymore ? :D

Derek wrote on August 21st, 2008 @ 9:25

@Sam: neat idea, I’ve never really thought about it. 

@Ihab: that’s a fine session lib, but yeah, with these additions I don’t see anything that it would offer you that isn’t available in the current CI session library.

Sam wrote on August 21st, 2008 @ 9:35

I have a lot of ideas ;)

Too Pixel wrote on August 21st, 2008 @ 12:54

That’s really an interesting addition. CI is becoming a real Killer framework and something says me it’s only starting… We are all waiting the end of summer ;)

John wrote on August 21st, 2008 @ 14:31

I’ve been waiting looong and patiently for this. As much as i like using 3PD libs, it just feels better using core CI stuff. Sorry OBSession but your time is nearly up!

How many times this year am i going to have to say “you da man” Mr Allard?

chris wrote on August 21st, 2008 @ 16:18

Good job! I was waiting for something like this in the CI core. This makes development in CI even faster for me. :)

Franka wrote on August 21st, 2008 @ 17:54

You guys are so good.  I love Code Igniter, and thanks so much for writing about it on your blog.  Its the easiest way to stay informed of whats new!

I’ve been using it since 1.4, and its growing so much thanks to you and everyone.

Derek wrote on August 22nd, 2008 @ 5:18

Thanks all, thrilled to keep growing this, although I can’t take credit for this addition to the Session class… that is pure Rick Ellis.

Jamie Rumbelow wrote on August 23rd, 2008 @ 8:53

Derek! Yes! Oh god yes!

:P

jeremy wrote on August 24th, 2008 @ 6:17

oooh.. i’ve been waiting for that for ages.

any idea how long until that makes it to a final release?

Derek wrote on August 24th, 2008 @ 12:02

any idea how long until that makes it to a final release?

Its in the SVN now, and will make it into the next release.  I’m not sure when the next release will be though, if that’s what you’re asking.

Sam wrote on August 25th, 2008 @ 2:28

Are there some very very special features that are kept exclusively for CI2? Say just “yes” or “not yet”, please ;)

Henrik Pejer wrote on August 27th, 2008 @ 4:17

Just saw another gem in the SVN: new validation class.

Wonderful!

mihailt wrote on September 19th, 2008 @ 13:25

While i do not really see why we should store sessions in database, for someone this might be a nice option to use in low-load projects. Good job.

Post a Comment

Sorry, comments are automatically closed after 45 days, or sooner if one entry gets targetted by spammers. Why not contact me directly?