The php form tutorial on this site doesn’t have any sort of bulk email protection. ie, a bored user could just keep going to the form and submitting, flooding my email.
I want to stop flooding by dropping a cookie once the form is submitted which would expire after 24 hours.
I found a cookie script to do it which I place in the HEAD of the form page:
<script>
<!--
// give feedback to the respondent about the state of their submission
function AllowNoDups()
{
var cookie_ls = document.cookie;
if (cookie_ls.indexOf(document.location) > -1)
{
alert("You've already submitted your answers. Thank you for your interest! ");
return false;
}
else
{
document.cookie = window.location.href + " from " + document.referrer + "; path=/; expires=Thu, 23-Aug-2012 00:00:01 GMT;";
return true;
};
};
//-->
</script>
Thing is, the date is such that it’s set manually.
What do I need to do to modify this so that the cookie expires after 24 hours, or do I need a whole new script?
Thanks.