Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: CGI chat room problem

by ChOas (Curate)
on Mar 12, 2002 at 13:50 UTC ( #151112=note: print w/replies, xml ) Need Help??

in reply to CGI chat room problem


I've done the same thing (build a chat, that is)...

You could do a couple of things, run a chat daemon (A
process that just runs, and gets information from your
chat script, and processes this), good thing here is that you
can have a loop in this program which just compares the
current time (as from "time()" (Seconds sinds the Epoch))
with the last time a user typed something (The way I did it
was have a hash, based on username, and that would store
amongst other things the last time a user typed something)
if the difference is bigger than, say, 5 minutes, it is
safe to delete this user from the hash as being an active user.

Another option is to have the script keep it`s state in
either a plain text file, or a database, whatever, whenever
an event occurs which calls your script (user
loging in, someone talking, whatever) it processes the file,
or database, and takes out idle users doing the same
compare I explained before.

Does this help ?


print "profeth still\n" if /bird|devil/;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://151112]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2016-10-28 08:09 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (377 votes). Check out past polls.