Re: Chatroom problems
| From: | Richard Lynch | Date: | Thu, 04 Jan 2001 18:41:01 +0000 |
| Subject: | Re: Chatroom problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32702@lists.php.net to get a copy of this message | ||
> I've built a chatroom in PHP : mySQL, which is working
> perfectly. Only problem is, once the user has gone
> form the chatroom after chatting, his records are not
> deleted. Anyone who ever enters the chat, his records
> are always there in the database even after he's left.
> And since the screen always shows the last 18
> statements, pretty old statments are always there and
> the "Online Users" also has the name of someone who's
> left. HOw do i do this? I mean, how do i erase his
> records once he's left? What i need is some kind of
> script which checks after one or two hours if there's
> any activity pertaining to that name or something and
> if unactive than delete all rows matching that name
> criteria....
Compile PHP as a CGI, as well as your current compilation.
(Tip -- You can probably find the settings you used previously in a file in
your php directory, named config.something. Not config.cache, the other
one...)
Then, you'll have a binary that you can use to execute PHP scripts just like
Perl or shell scripts. Throw it in /usr/bin if it's your own machine -- or
in your home directory if it's not.
Then, you can write a PHP script that starts with:
#!/full/path/to/php
<?php
.
.
.
Make the file executable:
chmod 775 whatever.php
Finally, the fun part -- You can automate the calling of that script using
"crontab".
man 5 crontab
will give you the details.
This topic has appeared in the list before, so a search for "crontab" may
provide more complete answers.