I use something like this:
$_SESSION['profane'] = false;
foreach ($_POST as $value) {
foreach ($swearbox as $profanity) {
if (preg_match("/$profanity/i", $value)) {
$errors = true;
$_SESSION['profane'] = true;
mail(TECHEMAIL, 'profane content attack attempt on DJST', "Word:
$value From: {$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s',
time()-TIMEDIFF), '[EMAIL PROTECTED]');
}
}
}
// second pass - words that are offensive in isolation but could be part of
acceptable words above
foreach ($_POST as $value) {
foreach ($refined_swearbox as $profanity) {
if (preg_match("/\b$profanity\b/i", $value)) {
$errors = true;
$_SESSION['profane'] = true;
mail(TECHEMAIL, 'profane content attack attempt on DJST', "Word:
$value From: {$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s',
time()-TIMEDIFF), '[EMAIL PROTECTED]');
}
}
}