PDA

View Full Version : Flood-limiting with PHP?



Daniel
July 29th, 2005, 01:22
Ugh I think I worded that right.

I'm coding my own little message board type php script, and I need to know the function, that basically counts the time elapsed since last execution of a script from a specific IP address. After a preset time has elapsed, the script can then be run again from that IP address.

Basically, it's a flood-limiting thingy that you see on all forums, or something...

yabziz
July 29th, 2005, 05:25
some code:
<?
//start session at header
$timeout=60*5;
$nowtime=time();
$last_click=$_SESSION[last_click];
if($nowtime-$last_click>$timeout)
{
exit("Fatal error");
}
else
$_SESSION[last_click]=time();
?>
I don't test it,but it should give you a idea how to code it:)