Re: Profanity Filter?

From: Date: Tue, 23 Jan 2001 07:30:39 +0000
Subject: Re: Profanity Filter?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36146@lists.php.net to get a copy of this message
> does anyone know where i can find a script that removes profanity and > replaces them with a character (****)? > my boos just came down on me because i told him we already had one, but > apparently it doesnt work. There was a thread just a few days ago on this forum about this... So, search the archives for really good answers first. Probably the first question you have to ask yourself is where/when to filter? On input, before output, some other weird time? The filter itself is fairly simple. You get your $words from somewhere, like a database or file or maybe you could put a hidden microphone in the PHB's office. That way, you'd have the words he's most likely to try when he tests your filter. :-) Then, you iterate through that list of words and do something not unlike this: while (list(,$word) = each($nasties)){ $text = pregi_replace($word, '&%#@$^', $text); } Odds are really good I got the pregi_replace arguments wrong -- I usually do, and then I have to go read http://php.net/pregi_replace

« previous php.general (#36146) next »