Jump to content

[SOLVED] Halting Php


Kingy

Recommended Posts

Is there any way to halt php...

 

I have made irc statistics using php/mysql and whilst in the irc room people can type `top10 to see who the top10 posters are,

 

what i would like to stop is people flooding..

I have placed a sleep(10) at the bottom off the top10 command but all that does is wait 10 seconds then it will keep going through the top10 just waiting for 10seconds before doing each one.. making the bot useless until it has finished going through them all.

 

What i would like it to do is disable that command completely for 10 seconds and if someone tries to use it display something like "Please wait 10 seconds before using this command again", but i still want to be able to use the other commands. Any ideas about doing this, or is this a bit to much

Link to comment
https://forums.phpfreaks.com/topic/86383-solved-halting-php/
Share on other sites

...because javascript works really well with IRC.

 

Your best bet is to create a file within the bot's directory and have a timestamp in it

 

Inside the file:

 

timestamp_of_last_request

 

Do a little math and allow the request, say..once every minute, else return an error 'top 10 already requested within the last X minutes'.

Link to comment
https://forums.phpfreaks.com/topic/86383-solved-halting-php/#findComment-441483
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.