Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.