Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6768617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:05:45+00:00 2026-05-26T15:05:45+00:00

I am making several classes for an IRC bot with PHP. The bot will

  • 0

I am making several classes for an IRC bot with PHP. The bot will ideally be a channel protective bot to kick and ban offenders.

Now, I have a good idea on how to do most things (swear words match, all caps, etc). But the most important things are the flood controls.

I want to see if a user types, let’s say, 5 lines of text in 3 seconds, or if the user inputted over 220 bytes of text in under 3 seconds, the bot will take action. This all of course is received in sockets, which I’m not very sharp at.

Examples:

Lines flood

[11:17:00] <user1> Hey!
[11:17:00] <user1> Hey!
[11:17:00] <user1> Hey!
[11:17:11] <user1> Hey!
[11:17:11] <user1> SPAAAAAACE!
*Line flood detected!*

Byte flood

[11:17:00] <user1> Hey! this is a very long long text.
[11:17:00] <user1> and I pasted it from a file or something so that these lines all occur one after another with 0 time
[11:17:00] <user1> This should be considered a byte flood since it's so very looooooooooooooong.
*byte flood detected overall counted bytes in the last 3 seconds from user1 is too much*

So the question: How can count if a certain input had occurred X time in Y seconds, and also how can I count if another certain input was X bytes (accumulative) was sent under Y seconds?

My code is similar socket-wise to the one Here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:05:45+00:00Added an answer on May 26, 2026 at 3:05 pm

    If you want to calculate sums over size and time, you need first of all to store the related data you want to make the calculations with.

    For example, each time a user types something:

    $store[] = array('user' => $user, 'len' => strlen($data), 'time' = now());
    

    To keep the example simple, I’m using an array. If you want to also track repetition, you need to store the data entered as well / and or compare against the data last entered by a user and see if it is the same.

    You can then use this array to calculate the values and check what you’re looking for.

    You can also after you made that remove all entries from that array that are older than a minute or so to keep that list small.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are making a game with a playing character that will have several different
I have several classes (for a Form generator class thing I'm making...I know sad..
My project uses several dll files with activex controls. Now I am making a
I am making several custom DataGridViewCell classes to handle various cases in my C#
I have some template classes I've written that are dependencies for several other classes
I am working on a project with several custom classes. I have a CardModel
I have a several classes DemandBuilding , Factory , Farm and some others. I
I have an parent class, and several child classes. What I want is when
I have been making several games with the Allegro API and C++. I have
I have asked several questions about making links on images in matlab, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.