Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: CGI chat room problem

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


in reply to CGI chat room problem

Hi,

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 ?

GreetZ!,
    ChOas

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-25 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found