Forum Moderators: coopster

Message Too Old, No Replies

Script to block an IP after x number of pages

         

rlkanter

6:25 pm on Apr 7, 2005 (gmt 0)

10+ Year Member



I've been trying to find a script that does this, or some information on where to start. A few times a month someone will download 50k-100k pages from my site in a few hours, generally I notice this and will block it (in the .htaccess file), but sometimes I won't. I was wondering if anyone has a script to stop this automatically, perhaps in addition sending me an email when someone is blocked.

I've tried blocking the known user agents, but a lot of the recent ones aren't sending a user agent at all, or the standard mozilla one.

I don't control the server itself, and the admin said that putting in apache controls to stop this would be too processor intensive.

My idea was to have a db table that stores the unique ips, the number of pages, and the last access timedate stamp.

Everytime the script is run it will try to retrieve the row with the ip address, if it exists it will increment the number of page loads, and set the time to the current time if the last page load was within 15 minutes of the last page load.

Otherwise it'll insert the new ip, etc.

I just don't want to reinvent the wheel if this has already been done and is readily available somewhere.

Thanks.

AlexK

12:36 am on Apr 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you have php available this thread should fix it:
[webmasterworld.com ]