The title pretty much sums up my question...
How can I stop people from using my "contact me" form 20 billion times in a row?
I thought about using a session and saying
Code: Select all
if($_SESSION['mailsSent']<=5)
{
// allow them to send another email
$_SESSION['mailsSent']++;
}
else
{
// tell them to stop spamming me
}
however, doesn't a session stay in the user's cookies for awhile? What if they have a different issue two hours later? So, I'd like this: check if a certain ip has sent more than 5 in 2 hours. If yes, stop them from sending more until two hours later. Is there any way to do that? Like, set a session['expireInTwoHours'] tag or something?