Anti-flood form with PHP
This is an easy solution to prevent somebody flooding your contact form.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<?php session_start(); // Place your Contact form script here // anti-flood protection if (!empty($_SESSION['antiflood'])) { $seconde = 30; // 30 seconds delay $tijd = time() - $_SESSION['antiflood']; if($tijd < $seconde) $antiflood = 1; } // Contact form mailing if ($antiflood == "") { $_SESSION['antiflood'] = time(); @mail($email_to, $email_subject, $email_message); } else { echo" Flooding detected"; } } ?> |
This script contains a 30 seconds delay before the same person can fill in the contact form again.
Leave a Reply