[phorm] [Phorm:] Re: Swear Words Filter

  • From: webbbs@xxxxxxxxx
  • To: support@xxxxxxxxx
  • Date: 31 Jan 2003 04:41:30 -0000

The following new message has been posted on Phorm Support Forum at 
<http://www.phorm.com/support/>. 

*************************************************************************** 

  MESSAGE:  (#2204) Re: Swear Words Filter 
            <http://www.phorm.com/support/?rev=2204> 
  AUTHOR:   Mike Casto 
  DATE:     January 30, 2003 at 11:41 p.m. EST 

  Reply To: (#1954) 
  Author: 
  Date: 

Hi. I'm building a similar filter right now. It's relatively simple. 

<? 

//$comments = the comment field that you're filtering 

$word_list = "word1,word2,word3,word4"; //The list of unacceptable words 

$replace_list = "*****,*****,*****,*****"; //The list of words to replace ... 
could be anything you prefer 

$words = explode(",", $word_list); //Creates an array of the words ... not 
necessary but I prefer working with arrays instead of lists. 

$replacements = explode(",", $replace_list); 

for($wc=0; $wc<count($words); $wc++){ 
str_replace($words[$wc], $replacements[$wc], $comments); //Substitute the "*" 
with whatever character you prefer. 
} 

?> 

If you were using PHP4, then it would be even easier ... 
str_replace($words[$wc],str_repeat("*", strlen($words[$wc])), $comments) 

Mike 

> Hi, 

> I have been using Phorm on a site for a couple of 
> months and it is working wonderfully - great program. 
> My question is, does anyone know of a way to introduce 
> a swear word filter on the comments box. The site is 
> an educational one and I want to try and stop the kids 
> from sending filthy messages to me... kids eh? 

> I have tried a javascript filter but when you 
> "view source" in the browser all the 
> filtered words appear, not ideal. 

> I am using PHP3 and version 3.04 of Phorm 

> Any ideas would be appreciated. Thanks 

> Jennie 

*************************************************************************** 

This is an automatically-generated notice.  If you'd like to be removed from 
the mailing list, please visit Phorm Support Forum at 
<http://www.phorm.com/support/>, or send your request to webbbs@xxxxxxxxxx  If 
you wish to respond to this message, please post your response directly to the 
board.  Thank you! 
-------------------------------------------------
You are receiving this message because you are subscribed to the Phorm mailing 
list. To send messages to the mailing list, simply send email to 
phorm@xxxxxxxxxxxxx from the address you have subscribed. You may unsubscribe 
from the list by sending email to phorm-request@xxxxxxxxxxxxx with 
'unsubscribe' in the SUBJECT field.

Other related posts: