This time I’m going to help all Developers. protecting your Contact Form from Spam Bots or Robots. They abuse the Contact Form by sending spam mails or any other way. Fortunately there are individual methods of slowing them down.
The Anti-Spam Question
You can simply change the Anti Spam Question.
Here’s the scripting:
<?php
// To mitigate the possibility of user errors, eliminate case-matching issues
$posted_var = strtolower($posted_var);
$answer = strtolower($answer);
// If $posted_var doesn’t match $answer
if($posted_var != “$answer”) {
// Return an error or give value to a feedback/output variable
}
?>
Regulating Input Lengths
I Recommend, limit the number of characters the user is able to provide in any given input.
Here’s the scripting:
<?php// If the$posted_varis greater than sixty characters…if(strlen($posted_var) > 60) {// Return an error or give value to a feedback/output variable}?>
There are many more Methods, This is the 2 Method that I usually use.