What I normally do in these situations is have two fields separated by tabs
or commas or whatever you want.  The first field is the username and the
second field is a timestamp.

The timestamp can be updated every time the user writes a message, since Im
sure you are logging also..  or after, say an hour, have their name removed
from the list, although this might make them have to log back in :)

Every time someone logs into the chat go through the list getting rid of any
usernames older than an hour or any other time.  And everytime someone logs
off do the same thing.. or if you get a lot of activity, just go through the
list when people logoff.

Cheers!

Rick

"If you're going to be able to look back on something and laugh about it,
you might as well laugh about it now." - Marie Osmond

> From: "Matt Palermo" <[EMAIL PROTECTED]>
> Date: Mon, 9 Jun 2003 17:19:31 -0400
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] php and flash chat program
> 
> Hey, I need some advice if anyone is willing to offer it.  I have a chat
> program I am working on.  The interface is built in flash, and it uses
> PHP also.  There is a main chat area where the users type their messages
> back and forth, and there is also a smaller area which displays all of
> the currently logged-in users.  When a user logs into the chat room, it
> adds their nickname to a users.txt file, which creates a list of all the
> online users and is then displayed in the chat page.  I also have a
> logoff button that will search for the users nickname in the users.txt
> file and remove it, so that it won't be displayed in the chat window
> anymore.  The only problem I am having is that if a user doesn't click
> on the logoff button and instead just closes the internet window or
> shuts off their computer, then their nickname will still appear in the
> list of users, since it wouldn't get a chance to be removed by the
> logoff button.  I'm not sure how to accomplish this, I would appreciate
> any help you can offer me.  Thanks a lot.
> 
> Matt
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to