Help with php code

Posted on 16th Feb 2014 by admin

Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow right past, and the comments get posted anyway?
heres the php code im testing on a server.

<?php
$words = array(

'murmer',
'frog',
'bat',

);

$continue = true;

foreach ($words as $word) {

if (preg_match('/b' . $word . 'b/i', $post)) {
$continue = false;
exit();
}

}

if (!$continue) {
// Bad boy!
}

else {
// Post message
}
$fc = fopen("comments.txt","a+b"); //opens the file to append new comment -
fputs($fc,$_POST['comments']."nnnNewComment->"); //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: mysite.html");
}

// end form processing
?>

Other forums