Re: Profanity Filter
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 19 Jan 2001 19:21:50 +0000 |
| Subject: | Re: Profanity Filter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35694@lists.php.net to get a copy of this message | ||
On Fri, 19 Jan 2001 Website4S@aol.com wrote:
> In a message dated 19/01/2001 19:03:13 GMT Standard Time,
> ignacio@openservices.net writes:
>
> << 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 >>
>
>
> Yeah problem is he has no database support from his host
>
> Ade
>
Ouch. All is not lost, however:
$words=Array(
"f***",
"s***",
...
); // Or use file() to read them from a file.
...
$done=false;
while ((list($key, $val)=each($words)) and $done===false)
{
$done=strpos(strtolower($name), $val);
};
if ($done!==false)
{
// Oops! Bad name.
}
else
{
// Okay, valid name.
};
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>