Note Submitter: luc at lucje dot removethisforspamplease dot
nl
----
I also wanted to read stores PHP sessions.
Here's my code:
function unserializesession($data) {
$vars=preg_split('/([a-z,A-Z]+)|/',$data,-1,PREG_SPLIT_NO_
EMPTY | PREG_SPLIT_DELIM_CAPTURE);
for($i=0; $vars[$i]; $i++) {
$result[$vars[$i++]]=unserialize($vars[$i]);
}
return $result;
}
// this is just for the example
$session='/tmp/sess_'.$PHPSESSID;
// Why isn't there a sfile() function that returns a file as
a string?
$h=fopen($session,'r');
$data=fread($h,filesize($h));
fclose($h);
$data=unserializesession($data);
Voila. It does the trick for me
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|