I'm using CodeIgniter's session library, which is really easy to access on the server side. On the client side, the session cookie looks like this (I bolded the part I'm interested in):
a:7:{s:10:"session_id";s:32:"47fe66476b098ff092f2fbdddfa53ffa";s:10:"ip_address";s:9:"127.0.0.1";s:10:"user_agent";s:50:"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv";s:13:"last_activity";s:10:"1296180527";s:7:"user_id";s:3:"895";s:8:"username";s:8:"Summer N";s:6:"status";s:1:"1";}fc0f1e75c097be7970b815a630bf33ef
Ahem. I want to access "username", which is currently set as the 8-character string Summer N. Is there an obvious way to parse this in javascript? Should I just use a regex? Or is the better way going to be creating my own "user" cookie with a simpler data format, and just letting CI's sessions do their own thing separately?