Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi Larry,

Regarding your spam blocker, of course, I have been using it.  However, I was still getting emails from automated spam producers, bots or whatever, so I thought I would share this little routine with you.  It simply checks to see if there is a human at the other end (who can add!!) and I now receive NO spam at all.

All I do is ask the customer to add two numbers.  I put these as numerics, but one could create an array with 1 = One, 2 = two etc etc.


I'll leave out all of the extraneous code.

Header etc etc


$check = $_POST['check'];  //Getting answer from customer of the addition.
$result2 = $_POST['checking'];  //Getting answer from the addition by the server.

//if then loops etc, with all of the questions etc....

//...after spam scrubber:

    if($check == $result2)

//Send the email to me and thank customer


        echo '<h2 style = "font-family: Arial, Verdana; font-size: 20px; font-weight: bold; background-color: #ffff99;">It seems that your arithmetic is erroneous.  Please try again.';  //Make the customer do the sum again.



//Start form action.....

Check:<br />  //Or you could write more informative text for the customer.


$random1 = RAND(1, 9);  //Invent an integer between 1 and 9.
$random2 = RAND(1, 9);  //Ditto.
$result1 = $random1 + $random2;  //Do the math!!
echo 'What is ' . $random1 . ' plus ' . $random2 . '? <input type="text" name="check" size="3"/><input type = "hidden" name = "checking" value = "' . $result1 . '" /><br /><br />' ; //Ask the customer the question - the answer to the addition.  Also send the server's answer ($result1).

<input type="submit" value="Send" ><input type="hidden" name ="Secure" value = "ejeewq8"> <input type="reset" value="Clear"> <input type = "hidden" name = "submitted" value = "submitted">  //Send it.

<br /><br />

I hope that you find it interesting.



Link to comment
Share on other sites


  • Create New...