Problem is that the string doesn't come in a format unserialize likes.
You're given "Config|%CONFIGSTRING%User|%USERSTRING%". You can
unserialize %CONFIGSTRING% and %USERSTRING%, but you need to extract
them first.

Is there a preferred way of doing this?


On Jan 14, 12:38 am, AZEL <[EMAIL PROTECTED]> wrote:
> u need unserilaize it.
>
> $array = unserialize('a:3:{s:9:"userAgent";s:
> 32:"c8cea9c1eac13b66616ef07d94528a70";s:
> 4:"time";i:1199123052;s:4:"rand";i:1343036056;}Message|a:0:{}ref|s:
> 12:"/users/index";ref1|s:13:"/users/login/";User|a:4:{s:2:"id";s:
> 1:"2";s:8:"username";s:2:"af";s:5:"email";s:22:"[EMAIL PROTECTED]";s:
> 10:"last_login";s:19:"2007-08-18 02:37:00";}UserProfile|a:10:{s:
> 9:"firstname";s:9:"Alexander";s:8:"lastname";s:4:"sd";s:3:"lkr";s:
> 1:"A";s:3:"zip";s:5:"86156";s:4:"city";s:8:"Essen";s:
> 10:"country_id";s:
> 1:"1";s:4:"tel1";s:14:"016 17";s:4:"tel2";s:0:"";s:3:"www";s:
> 17:"test.de";s:6:"public";s:1:"1";}');
>
> use like that
> $array['userAgent'] // c8cea9c1eac13b66616ef07d94528a70
> or
> $array['time'] // 1199123052
>
> On Jan 13, 7:29 pm, cronet <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > it's more a general question, not directly cake related.
>
> > If I store a Session in my db, the "data" field looks like:
>
> > Config|a:3:{s:9:"userAgent";s:32:"c8cea9c1eac13b66616ef07d94528a70";s:
> > 4:"time";i:1199123052;s:4:"rand";i:1343036056;}Message|a:0:{}ref|s:
> > 12:"/users/index";ref1|s:13:"/users/login/";User|a:4:{s:2:"id";s:
> > 1:"2";s:8:"username";s:2:"af";s:5:"email";s:22:"[EMAIL PROTECTED]";s:
> > 10:"last_login";s:19:"2007-08-18 02:37:00";}UserProfile|a:10:{s:
> > 9:"firstname";s:9:"Alexander";s:8:"lastname";s:4:"sd";s:3:"lkr";s:
> > 1:"A";s:3:"zip";s:5:"86156";s:4:"city";s:8:"Essen";s:10:"country_id";s:
> > 1:"1";s:4:"tel1";s:14:"016 17";s:4:"tel2";s:0:"";s:3:"www";s:
> > 17:"test.de";s:6:"public";s:1:"1";}
>
> > I would like to know, how this is format called ?! Need to debug a
> > website which has stored some data which looks exactly this way. I
> > don't know how to extract data without complicated find and strip
> > actions. Perhaps there's smarter way I don't know!
>
> > Regards,
> > Alexander

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to