Welcome Guest, Not a member yet? Register   Sign In
Retrieving 'user_data' in Session Database
#1

[eluser]jova[/eluser]
How do you retrieve and make sense of user_data array from the CI_SESSION table?

a:3:{s:10:"user_email";s:23:"[email protected]";s:7:"user_id";s:1:"1";s:1:"l";s:1:"1";}
#2

[eluser]Thorpe Obazee[/eluser]
Code:
print_r($this->session->userdata);
#3

[eluser]jova[/eluser]
I know i can get it to print, but how do I take it apart and actually make use of the data.
#4

[eluser]Thorpe Obazee[/eluser]
What do you mean by "take it apart"?
#5

[eluser]jova[/eluser]
I can't really do much with

a:3:{s:10:“user_email”;s:23:“[email protected]”;s:7:“user_id”;s:1:“1”;s:1:“l”;s:1:“1”;}

How do I take whatever data is in the session database's 'user_data' column and actually use it. (i.e. How do I say something like if the user's session matches the database session id, check to see if the cookie and database email matches)
#6

[eluser]Colin Williams[/eluser]
http://us3.php.net/unserialize

But, you should really just use the Session class functions, like $this->session->userdata('email'); The Session class handles the validation you talked about for you (matching the session IDs)




Theme © iAndrew 2016 - Forum software by © MyBB