Welcome Guest, Not a member yet? Register   Sign In
How to store "custom session data" in sessions table?
#1

[eluser]inktri[/eluser]
So I'm using the session class and want to store in the sessions table more than just the IP, session id, etc. How can I store the custom session data such as username, and logged_in in the sessions table? I tried altering the schema so each sessions record has a username field and a logged_in field; however the values of those fields never change accordingly.

Code:
$newdata = array(
                   'username'  => 'johndoe',
                   'email'     => '[email protected]',
                   'logged_in' => TRUE
               );

$this->session->set_userdata($newdata);
#2

[eluser]Dready[/eluser]
You'll find in the wiki ( http://codeigniter.com/wiki/DB_Session/ ) a drop-in replacement for CodeIgniter sessions, that will fit your needs.
#3

[eluser]llbbl[/eluser]
its usually not a big deal, storing them in the cookie as long as you don't store a bunch of stuff. you might try encrypting the cookie if your worried about cross site cookie hax.

if you store it in the database, you will still need to set the cookie with the session key, so your going to be using cookies one way or another. setting the cookies helps prevent things like people logging on with different computers in a network, so like you could use your coworkers account if you could successfully duplicate his user agent.




Theme © iAndrew 2016 - Forum software by © MyBB