View unanswered posts | View active topics It is currently Sun Dec 17, 2017 2:32 pm



Reply to topic  [ 1 post ] 
 stop word code not working.. 
Author Message
Junior Member

Joined: Mon Aug 29, 2005 11:13 am
Posts: 17
Post stop word code not working..
<?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


Sun Aug 13, 2006 6:01 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.