Welcome Guest, Not a member yet? Register   Sign In
decode session userdata in DB
#1

[eluser]gscharlemann[/eluser]
I setup storing session data in a database and did a simple login with a user (admin@admin.com). When I look in the DB table, the userdata column has the following data:
Code:
a:5:{s:5:"email";s:15:"[email protected]";s:2:"id";s:1:"1";s:7:"user_id";s:1:"1";s:8:"group_id";s:1:"1";s:5:"group";s:5:"admin";}
How do I decipher this?
I know that:
user_id = 1
group_id = 1
group = admin
email = admin@admin

but what do the s:5: and a:5: mean? If I didn't know the above info (user_id, group_id), I'm not sure I'd be able to figure it out by looking at the userdata in the DB.

Thanks for your help.
#2

[eluser]InsiteFX[/eluser]
When data is stored in the database it is a serilized array.

If you want to view it you would need to unserialize it.

But you can just use the session methods to retrieve the session data.

InsiteFX
#3

[eluser]gscharlemann[/eluser]
I did not know that. Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB