|
Posted by Manish on 02/01/07 06:17
$currentmin = mktime(date("H") , date("i"), 0, date("m"), date("d"),
date("Y"));
if(is_file($currentmin)) {
/*
get the content of the file
if content of file > 10 (max limit per minute)
display some message/redirect ...
else
increment the value of the content read from the file and write it
back to the file
process MySQL operations ...
*/
} else {
//create a file $currentmin
//write the content "1" to the file
}
//you will need to delete the older $currentmin files by some scripts
On Feb 1, 4:30 am, "Nu" <n...@spam.com> wrote:
> I want to protect myself from if someone with a fast connection hammers my
> site. It's not denial of service attacks, but offline downloaders (of course
> that don't show they're offline downloaders in the useragent so I can't
> filter them by that). My main issue is my site is PHP so if they hammer it,
> it gets all the PHP files executing and overwhelms the CPU. I'd like to be
> able to after a certain amount of hits on my index.php per second, so just
> refuse.
>
> I can't find how to do that. Can it be done in PHP, htaccess, etc.
>
> Any ideas?
Navigation:
[Reply to this message]
|