Re: read session data without starting session
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: read session data without starting session | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171168@lists.php.net to get a copy of this message | ||
I don't really understand why you are looping through things there. A
simple unserialize() on everything after the session_name| part will work
just fine on arrays and everything else as well.
-Rasmus
On Wed, 26 Nov 2003, Andrew Warner wrote:
> I have a script that browses a sessions table and extracts and
> displays the session values for display. The function below (I don't
> remember where I got it) extracts session data without starting a
> session, but it doesn't handle session values that are arrays.
> Anyone have something like this that works?
>
>
>
> function sess_string_to_array($sd)
> {
> $sess_array = array();
> $vars = preg_split('/[;}]/', $sd);
>
> for ($i=0; $i < sizeof($vars); $i++)
> {
> $parts = explode('|', $vars[$i]);
> $key = $parts[0];
> $val = unserialize($parts[1].";");
>
> $sess_array[$key] = $val;
> }
>
> return $sess_array;
> }
>
>
> aw
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>