Displaying users online using sessions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Kivork
Forum Newbie
Posts: 4
Joined: Sun Jun 29, 2008 6:38 pm

Displaying users online using sessions

Post by Kivork »

I want to be able to show the current users online. I've found a script that counts the number of active usrs online, however if I modify it slightly to display those user's usernames (by directly reading raw data from the session files) I get no output.
Is access to these files denied due to security issues? And if so what would be the simplist alternative?
koen.h
Forum Contributor
Posts: 268
Joined: Sat May 03, 2008 8:43 am

Re: Displaying users online using sessions

Post by koen.h »

Session data is serialized. If that's not the problem maybe you could give us the part of the script that doesn't do what you expect it to do.
Kivork
Forum Newbie
Posts: 4
Joined: Sun Jun 29, 2008 6:38 pm

Re: Displaying users online using sessions

Post by Kivork »

I figured out the problem, or at least a solution. It seemed I was not able to correctly read the session file after calling session_start(), which I guess makes sense. I simply removed that call in the script and I was able to read the file fine.

Thank you for your help.
Post Reply