You are here: Ban Spamers IP Addresses « All PHP « IT news, forums, messages
Ban Spamers IP Addresses

Posted by Andy on 09/19/05 23:51

I made a script to write all posted data by a form in CSV file. I did also a
script to ban spammers IP Addresses. When banned spammer wants to use my
form ito send a letter he gets a warning message. Unfortunately all spammers
data he tried to send is recorded in CSV file. Please tell me how to modify
my script so the spammer will get a warning message but his data will not be
recorded after he press a send button. Thank you.

This is a script to record data to CSV file (letters.CSV).


$filename = "letters.csv";
touch ("$filename");
$fpc = fopen($filename, "a") or die ("Couldn't open $filename");
fputs($fpc,"\n\"$_POST[from],\"
$_POST[email],\"$_POST[message],");fclose($fpc);


This is a script to ban IP Addresses :

$ban_ip_on = "yes";

$ban_ip_list = "111.222.33.55,
11.33.777.99,";

if($ban_ip_on == "yes") {

if(strstr($ban_ip_list, $HTTP_SERVER_VARS[REMOTE_ADDR])) {
echo "<div align='center'><span class='contact6'> Error - Banned
IP</span><br><br><span class='cbull'>&bull;
</span><span class='contact5'>
You cannot use this form because your IP address has been banned by the
administrator.</span><br><br><input type=button value='&gt; &gt; Close
Window &lt; &lt;'
onClick=javascript:closewindow(); name='button'></div>";
$error = "yes";
}
}


if($error == "yes") {
exit();
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация