Connecting Tech Pros Worldwide Help | Site Map

Looping through session data

ensnare
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi all,

I'm using a database session handler and am looking to loop through
data residing in the sessions table to make a 'Users online' array.

I've found that using urldecode on the data column gives me a
serialized string of varname|datatype:data; for each variable. I'm
having a bit of trouble with deserializing the data.

I could always use regexps to grab the specific data I want, but I'm
sure there's a better way to do this. Any help is greatly appreciated.

Thanks much!
steve
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Looping through session data


ensnare wrote:[color=blue]
> Hi all,
>
> I’m using a database session handler and am looking to loop through
> data residing in the sessions table to make a ’Users online’ array.
>
> I’ve found that using urldecode on the data column gives me a
> serialized string of varname|datatype:data; for each variable. I’m
> having a bit of trouble with deserializing the data.
>
> I could always use regexps to grab the specific data I want, but[/color]
I’m[color=blue]
> sure there’s a better way to do this. Any help is greatly[/color]
appreciated.[color=blue]
>
> Thanks much![/color]
PHP has a nice way of looping thru variables inside an array so with
query string you can do something like this:

foreach ($GET as $key => $value) {
//not do something with $value[$key]...
}

same for cookies, $_PUT, $_SERVER, etc.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Looping-...ict124156.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=413682
Jochen Daum
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Looping through session data


Hi ensnare,

On 28 Jun 2004 18:11:04 -0700, ensnare@gmail.com (ensnare) wrote:
[color=blue]
>Hi all,
>
>I'm using a database session handler and am looking to loop through
>data residing in the sessions table to make a 'Users online' array.
>
>I've found that using urldecode on the data column gives me a
>serialized string of varname|datatype:data; for each variable. I'm
>having a bit of trouble with deserializing the data.[/color]

Have you tried unserialize()?

HTh, Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Closed Thread