I'm trying to set an anti-dupe/spam mechanism that will prevent someone from submitting a form twice in 60 seconds (primarily to prevent dupe posts). Originally, I was using a cheap hack that helped some, but doesn't work adequately.
setcookie('showtime', 'posttime', time() + 60);
if (IsSet ($showtime)) {
include ("/home/dcshows/www/top.php");
echo "Need to wait 1 minute before posting another show. We hate spam!";
include ("/home/dcshows/www/bottom.php");
exit;
}
I'm thinking this may be a good way to go if I can learn how to set a timestamp, then compare it somehow to the current time and if it's less than 60 seconds, spit out the error message. I'm slowly but surely working on it. Here's what I have so far:
setcookie('showtime', 'posttime', time() + 60);
if ($showtime - time() <= 60) {
include ("/home/dcshows/www/top.php");
echo "Need to wait 1 minute before posting another show. We hate spam!";
include ("/home/dcshows/www/bottom.php");
exit;
}
I know it's dorked up right now, but that's the direction I'm heading. Does anybody have a better idea, or can you point me in the right direction with the comparison?