unserialisation of sessoin variables
| From: | Dimitri Smits | Date: | Wed, 06 Sep 2000 02:55:07 +0000 |
| Subject: | unserialisation of sessoin variables | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-2444@lists.php.net to get a copy of this message | ||
hello all,
again a question. Since you seem to be able to initialise a session
once (not anymore after a destroy), I need a means to deserialize
session data.
I will explain what I intend to do:
- no cookies (as requested by client)
- I overload the session_save_handler functions with my own, no probs
there
- I need another kind of GC than the one provided to eliminate session
files distinct from the one called by PHP, which needs to check a
session variable (so, not the file_last_access_time or something)
- this all to eliminate illegal use of a session by some other user
(inside the session are a few keys that need te be validated first
before the data can be used ... for this I also need this deserialiser
because of the original gc and improper use of a disconeected users'
session)
- I also need to be able to use this function in a cronjob-php called
with the CGI version ofcourse ;-)
now, what I need is this:
with the read() function in the session_save_handler, I need to be
able to load the file associated with the session (which I succeed),
but it returns a string like this:
---
$count = 255;
$foo = "I'm a lousy excuse for a string!";
---
output string is:
"count:i:255;foo:s:32:I'm a lousy excuse for a string!"
now, how do I get 'count' and 'foo' back out of this string?
is there a function that does so (unserialize()?) and how do
I implement this to get "255" back in $count (a local var)
and "I'm a lousy excuse for a string!" back into $foo?
I will be using it to validate (without using session_start() first)
and inside this cronjob (which has to validate a variable iso
last_file_acces, for variable time_outs) that does some gc (among
other things).
thnx in advance!
--
Hoogachtend,
Dimitri Smits,
Praeses WINAK 1999-2000
*************************************************************
Winak HomePage: http://www.winak.cx
Green HomePage: http://chaos.concepts.nl/~green
e-mail: gongo@vt4.net
*************************************************************