tedd wrote: > At 3:14 PM -0700 8/25/08, Jim Lucas wrote: >>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); >> 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 > > > 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. > > Cheers, > > tedd > I figure their spamfilter would have permanent epilepsy if they took a feed from the Scunthorpe Evening Telegraph's site at http://www.thisisscunthorpe.co.uk/ Cheers -- David Robley Phobia: what's left after drinking 2 out of a 6 pack Today is Prickle-Prickle, the 20th day of Bureaucracy in the YOLD 3174. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php