Hello, how would i go about "Joining" these two scripts shown below, the idea is to reject and not post the comment if trigger words are found, and maybe add an alert or just redirect back to the comment input page without posting the comment, redirect command would be prefered, any help would be greatly appreacated.
simple php-word trap
<?php
$words = array(
'bad1',
'bad2',
'bad3',
);
$continue = true;
foreach ($words as $word) {
if (preg_match('/\b' . $word . '\b/i', $post)) {
$continue = false;
exit();
}
}
if (!$continue) {
// Bad boy!
}
else {
// Post message
}
?>
joined to this php code "fopen fclose" and "email me" php code?
<?
$fc = fopen("comments.txt","a+b"); //opens the file to append new comment -
fputs($fc,$_POST['comments']."\n\n\nNewComment->"); //writes the comments followed by a
fclose($fc); //closes the files
if(sizeof($_POST)) {
$body = "";
while(list($key, $val) = each($HTTP_POST_VARS)) {
$body .= "$key: $val \n";
}
mail("myEmail@myEmail.com", // to
"Subject Line",
$body);
header("Location: myproject.html");
}
// end form processing
?>