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

  • SEARCH
  • Home
  • 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 8711817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:58:41+00:00 2026-06-13T04:58:41+00:00

Possible Duplicate: Prevent PHP script from being flooded Certain friends of mine keep messing

  • 0

Possible Duplicate:
Prevent PHP script from being flooded

Certain “friends” of mine keep messing around on my site by holding down the refresh key. This makes their content’s pageviews unrealistically increase and also it adds server load to points where PHP stops running.

I was hoping if there was a way to prevent such intense refreshes (one of them got 30 thousand requests in 1 1/2 hrs) using PHP or JavaScript?

  • 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-06-13T04:58:42+00:00Added an answer on June 13, 2026 at 4:58 am

    You could always count how many requests a user is making from a certain ip address, and stop returning anything but an Unauthorized after a certain limit is reached.

    This is a pretty simple solution, but would probably do the job. You can cut it off by requests/time interval or like no more than 100 page requests in two minutes or something. You could then either ban the IP, or return error codes for a specified amount of time. That specified amount of time could be something hard coded like 5 hours, or you could just wait for their requests/time interval to go down organically.

    function isIpBlocked($ip)
    {
        //do mysql query to check if column is true
    }
    
    function shouldIpBeBlocked($ip)
    {
        //do mysql query to check if number of request over a certain interval is too high
    }
    
    if(isIpBlocked($ip))
    {
        header('HTTP/1.0 401 Unauthorized');
    }
    else
    {
       if(shouldUserBeBlocked($ip))
       {
           //do sql update/insert to indicate user is blocked in ip_block table or something
           header('HTTP/1.0 401 Unauthorized');
       }
       else
       {
          //update number of requests from this ip address INSERT INTO ip_history (ip, ...) VALUE (:ip, ....);
          //do your web site code
    
          //maybe do a mysql query to clean out ip_history table for requests that happened a long time ago and check to see if you should unban people
       }
    }
    

    You put that code on every page of your site, and it will ensure that users have not been breaking your predetermined security rules.

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

Sidebar

Related Questions

Possible Duplicate: Best way to prevent SQL Injection in PHP On my site I
Possible Duplicate: Prevent a background process from being stopped after closing SSH client I
Possible Duplicate: Is there a way to prevent a class from being derived from
Possible Duplicate: Best way to prevent SQL injection in PHP? I've made a PHP
Possible Duplicate: how to prevent multiple form submit from client side? We have a
Possible Duplicate: Best way to prevent SQL injection in PHP? My html web form
Possible Duplicate: Best way to prevent SQL injection in PHP? I am building my
Possible Duplicate: Best way to prevent SQL injection in PHP? This is a simple
Possible Duplicate: How to prevent IFRAME from redirecting top-level window <iframe width=980px frameborder=0 marginheight=0
Possible Duplicate: Prevent click event from affecting parent jquery I have a DOM structure

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.