Ok, I searched and found a sample on how to replace profanities with XXXX or something. But what I need is it to scan form inputs (5 inputs), and if a badword is in any of the inputs then it needs to set a new variable to yes. Later in the script I check and see if that variable = yes and if it does it redirects to the form witht he correct error message.
The problem I'm having right now is if the badword is in a sentence like crap on a stick. It doesn't recognize it as one of the words. I see why its not working, but my php knowledge is limited so I just don't know how to work around it. Is there a way to just look for any of the words in the array in a certain variable? Thanks!
$badwords = array("darn","doh","nuts","crap");
while (list($key, $value) = each($badwords))
{
$error = str_replace("$value","yes",$line1);
if ($error == "yes") {header("Location: index.php?error=yes");
exit;}
$error = str_replace("$value","yes",$line2);
if ($error == "yes") {header("Location: index.php?error=yes");
exit;}
$error = str_replace("$value","yes",$line3);
if ($error == "yes") {header("Location: index.php?error=yes");
exit;}
$error = str_replace("$value","yes",$line4);
if ($error == "yes") {header("Location: index.php?error=yes");
exit;}
$error = str_replace("$value","yes",$line5);
if ($error == "yes") {header("Location: index.php?error=yes");
exit;}
}