Flood ProtectionDescription
This tutorial will show you how to stop someone from posting over and over again on your website. Tutorial<?
//Sets the value of the cookie.
$postcheck = $_COOKIE["posted"];
//Checks to see if there is a value in the cookie
if ($postcheck =="")
{
//If the cookie is empty, set one. This one is set for 30 seconds.
setcookie ("posted", "comment", time()+30,"/");
}
else
{
//If the cookie is not empty, the code stops.
echo "You must wait 30 seconds before posting another comment";
exit;
}
?>
Simply add this code to the page that makes the post and you should be set.
|