...

View Full Version : check for bad words



esthera
04-27-2006, 10:41 AM
can someone help me with the following --

I want to loop through all the fields from the form collection and then check through a list of words (badwords) and if any of those words exist in the form then to set a variable $filtered=1

NancyJ
04-27-2006, 10:50 AM
$filtered=0;
$badwords = array("feck", "arse", "boobs");
foreach($_POST as $val)
{
foreach($badwords as $swear)
{
if(strpos($val, $badwords)!==false)
{
$filtered=1;
return;
}
}
}

or something similar

esthera
06-21-2006, 07:57 PM
does not seem to be working properly.
shouldn't this take out any word in the form? (regardless of wether there is a space before and after?)
also how can I make it not case sensitive?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum