Re: comments function being spammed, how do I stop it?
| From: | Stut | Date: | Tue, 26 Aug 2008 14:37:11 +0000 |
| Subject: | Re: comments function being spammed, how do I stop it? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278722@lists.php.net to get a copy of this message | ||
On 26 Aug 2008, at 15:23, tedd wrote:
At 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. -Stut -- http://stut.net/Here 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