Search the Community
Showing results for tags 'spam'.
-
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 <?php $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 } else { 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. <?php $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. Regards Max
-
Hi there I hope you are well, Larry. I decided to re-visit my 'Contact us' page and review the spamscrubber. I was having trouble getting the spamscrubber to fish out the '\n's and '\r's to the extent that I changed the blank spaces to letters: function spam_scrubber($value) { //Create spam scrubber array.............. $very_bad = array('to:' , 'cc:' , 'bcc:' , 'content-type:' , 'mime-version' , 'multipart-mixed' , 'content-transfer-encoding:'); //For loop comparing email text to bad words....... foreach ($very_bad as $v) { //Look for bad word using stripos to ID the characters in the string. It will return a blank if found...... if (stripos($value, $v) !== false) { return 'AA'; } } $value = str_replace(array( "\r" , "\n" , "%0a" , "%0d"), 'BB' , $value); echo $value; return trim($value); } which made it easier to see what was going on. Thus my enquiry that included some '\n's and '\r's went through the email system WITH the '\n's and '\r's. So I then changed the code to (in red): function spam_scrubber($value) { //Create spam scrubber array.............. $very_bad = array('to:' , 'cc:' , 'bcc:' , 'content-type:' , 'mime-version' , 'multipart-mixed' , 'content-transfer-encoding:'); //For loop comparing email text to bad words....... foreach ($very_bad as $v) { //Look for bad word using stripos to ID the characters in the string. It will return a blank if found...... if (stripos($value, $v) !== false) { return 'AA'; } } $value = str_replace(array( "\\r" , "\\n" , "%0a" , "%0d"), 'BB' , $value); return trim($value); } and it works just fine. Thought I should let you know. Regards Max
- 3 replies
-
- spamscrubber
-
(and 1 more)
Tagged with: