CodeIgniter: store more information into the session?

You can use the normal CI session handling done in CI $this->session->set_userdata('usertype', 'admin') For checking for usertype. I usually have a authentication class that checks if the user logged in is an admin. E.

G function logged_in($role = NULL) { if (! $this->CI->session->userdata('logged_in')) { return FALSE; } if ($this->CI->user->has_role($role, $this->CI->session->userdata('user_id'))) { return TRUE; } return FALSE; } // function restrict() About saving information, using the session, it is probably not the safest. I usually recommend checking for user information on the fly rather than storing everything in the CI session.

You can use the normal CI session handling done in CI. $this->session->set_userdata('usertype', 'admin'); For checking for usertype. I usually have a authentication class that checks if the user logged in is an admin.E.g.

Function logged_in($role = NULL) { if (! $this->CI->session->userdata('logged_in')) { return FALSE; } if ($this->CI->user->has_role($role, $this->CI->session->userdata('user_id'))) { return TRUE; } return FALSE; } // function restrict() About saving information, using the session, it is probably not the safest. I usually recommend checking for user information on the fly rather than storing everything in the CI session.

You mean query the database each time and not store it into a session. But the sessions are saver, if you still could let me know how to store more info into the sessions. – krike Feb 27 '10 at 16:34 query the database each time so that the a user whose usertype has been changed while he is logged in could work as soon as he loads the page.

– Thorpe Obazee Feb 27 '10 at 18:08 Anyway, to store information you only need to use $this->session->set_userdata('usertype', 'admin'); – Thorpe Obazee Feb 27 '10 at 18:09 You could then read it via $this->session->userdata('usertype'); – Thorpe Obazee Feb 27 '10 at 18:09.

You can use the normal CI session handling done in CI. For checking for usertype. I usually have a authentication class that checks if the user logged in is an admin.

About saving information, using the session, it is probably not the safest. I usually recommend checking for user information on the fly rather than storing everything in the CI session.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions