Re: Profanity Filter
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 19 Jan 2001 19:03:05 +0000 |
| Subject: | Re: Profanity Filter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35691@lists.php.net to get a copy of this message | ||
On Fri, 19 Jan 2001 Website4S@aol.com wrote:
> Hi,
>
> I`m trying to setup a little profanity filter for a client of mine just
> wondered if anyone could offer some advice on how best to handle it. I was
> thinking of going along these lines...
>
> $filter="moron";
>
> if($Name==$filter)
> {
> printf...Javascript you can`t use that etc
> }
>
> Name is passed from a form, the problem is there are going to be quite a few
> words, so how is the best way to store these words. Something like this??
>
> $filter="moron idiot pratt"
>
> And if $Name was sent through as "moron pratt" would it still pick it up??
>
> TIA for any help
>
> Ade
>
Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name') LIKE
'%'+word+'%'" and count how many rows are returned. No need to re-invent
the
wheel.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>