Re: comments function being spammed, how do I stop it?
| From: | Jim Lucas | Date: | Tue, 26 Aug 2008 17:09:35 +0000 |
| Subject: | Re: comments function being spammed, how do I stop it? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278740@lists.php.net to get a copy of this message | ||
Stut wrote:
On 26 Aug 2008, at 15:23, tedd wrote:Let me try again. I will only supply a link to the file instead of including it for every spam trap to catch... :) http://www.cmsws.com/examples/data/spamwords.dat -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William ShakespeareAt 3:14 PM -0700 8/25/08, Jim Lucas wrote:In my experience most spam can be blocked by case-insensitively checking for "[url" and "<a". There ain't many spam comments out there that don't include URLs. -StutHere is the function that I added to a generic guest book script. It works great for me. I have a predefined list of sexual, pharmaceutical, rude, vulgar, etc... words that I have in the spamwords.dat file. function is_spam($str) { $data = './data/spamwords.dat'; $spamword = file($data); $str = strtolower($str); foreach ($spamword AS $word) { $word = trim($word);Will you share your spamwords.dat file? I get too excited trying to type them in myself. :-) This reminds me (if I have my story correct) that recently a Christian web site had a similar filter except it filtered news they scrubbed off other site/sources. One of their routines checked for offensive words and then replaced them with PC words. This receive national attention when their site changed Tyson Gay's name to Tyson Homosexual.if ( ! empty($word) && // Blank line strpos($word, 0, 1) != '#' && // Comment line strpos($str, strtolower($word)) !== false ) { // Compare return true;} } return false; } Just setup the spamwords.dat file to have each word/string that you want to reject for separated on each line. -- Jim Lucas