Results 1 to 2 of 2
Feb 6, 2001, 12:37 #1
Hey! ya fellas,
The same has been posted under a different category also, since I was also looking for ColdFusion, but since I am also thinking of PHP, I thought I should also have it posted here again, so do notconsider it as a repeated message!
Say, like when you have a users database in your site and if your site's users are controlled by user login and registration procedures, how can you show in real time which user is online at a particular moment when you are online and who is offline.
For example if you look to your left :
<<==== Look to your left at this thread to see my status
at the sitepoint site, you can see the user's status in realtime, if online or not.
I intend to either use PHP or ColdFusion to do this, but simply have no idea how to do it!
Can someone explain how to do this ?
Feb 6, 2001, 13:40 #2
- Join Date
- Aug 1999
- Pittsburgh, PA, USA
- 0 Post(s)
- 0 Thread(s)
I can't walk you through everything, but I'm fairly sure this is done with sessions - new to PHP4, I think.
I've read up on sessions in ASP a bit, and the basic logic behind it (assuming it's the same for PHP), is that the server can handle a lot of the session work for you: you can create a session everytime someone loads a page with a very simple command, and tell it how many minutes it should take to expire...
...so basically, if you set it to 5 minutes, it will end the session if they go 5 minutes without loading any pages on your site. You use a similar command when the session ends - you keep a common, global variable in some included and/or text file, and count the number up or down when each of these commands is executed.
I might be able to go into the actual code a bit, but that's it written in plain text. As you can see, using sessions, it wouldn't be hard to show the number of users currently logged on - targetting each one individually like this would probably be a bit trickier, though.