<?PHP
# Contact form..
error_reporting(7);
#----------
# Filter by Stop Words
function stopwords_check()
{
$StopWordsFile = '../web/stopwords.txt';
if (file_exists($StopWordsFile) === false) {
echo 'The Stop Words file: <b> ' . $StopWordsFile . '</b> cannot be found on the server.';
exit;
}
$bannedstopwords = file($StopWordsFile);
foreach ($_POST as $fieldname => $fieldvalue) {
foreach ($bannedstopwords as $stopword_key => $stopword_value) {
$pattern = '/.*' . rtrim($stopword_value) . '.*/';
if (preg_match($pattern, $fieldvalue)) {
header("Location: http://www.monikaa.uni.cc/banneduser.htm");
exit;
}
}
}
}
#----------
# Filter by IP Address
function ipaddress_check($ClientIP)
{
$bannedIPsFile = '../web/bannedip.txt';
if (file_exists($bannedIPsFile) === false) {
echo 'The banned IPs file: <b> ' . $bannedIPsFile . '</b> cannot be found on the server.';
exit;
}
$bannedips = file($bannedIPsFile);
foreach ($bannedips as $ip_key => $ip_value) {
if (rtrim($ip_value) == $ClientIP) {
header("Location: http://www.monikaa.uni.cc/banneduser.htm");
exit;
}
}
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}
stopwords_check();
ipaddress_check($ClientIP);
# RegisterGlobals OFF
$FTGname = $_POST['name'];
$FTGemail = $_POST['email'];
$FTGmailingaddress = $_POST['mailingaddress'];
$FTGsubject = $_POST['subject'];
$FTGmessage = $_POST['message'];
if (get_magic_quotes_gpc) {
$FTGname = stripslashes($FTGname);
$FTGemail = stripslashes($FTGemail);
$FTGmailingaddress = stripslashes($FTGmailingaddress);
$FTGsubject = stripslashes($FTGsubject);
$FTGmessage = stripslashes($FTGmessage);
}
# Redirect user to the error page
if ($validationFailed == true) {
header("Location: error.html");
exit;
}
# Email to Form Owner
$emailTo = '"Monika" <monika@monika.name>';
$emailSubject = "Mail from $FTGname";
$emailSubject = preg_replace('/[\x00-\x1F]/', '', $emailSubject);
$emailFrom = "$FTGemail";
$emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom);
$emailBody = "" . $_SERVER['HTTP_USER_AGENT'] . "\n"
. "$ClientIP\n"
. "\n"
. "Azalea mail..\n"
. "\n"
. "name: $FTGname\n"
. "email: $FTGemail\n"
. "mailingaddress: $FTGmailingaddress\n"
. "subject: $FTGsubject\n"
. "message: $FTGmessage\n"
. "\n"
. "";
$emailHeader = "From: $emailFrom\n"
. 'Cc: "Moni" <moni@yahoo.com>' . "\n"
. "Reply-To: $emailFrom\n"
. "MIME-Version: 1.0\n"
. "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-transfer-encoding: 8bit\n";
mail($emailTo, $emailSubject, $emailBody, $emailHeader);
# Redirect user to success page
header("Location: success.html");
exit;
# End of PHP script
?>
stop word code is not working... if the word is good then also it shows page of banneduser.htm
stopwords.txt contain following word in below format
bad gir
ass