Version: 1.1a
Revision: 34
Say NO to SPAM!
Introduction: for the passed two days, I was revising my IP – ban – script. So that it doesn’t comprise your server load and time, especially, when there is high traffic. Nevertheless, this script was created from my previous article. But, I decided to modified it and make it smaller for everyone to use and share.
On the other hand, this script is everywhere on the search engine. But, please understand, that I had spent a great amount of time, just to refurbish these scripts.
1.] Login to your Cpanel and click on your FTP server. After that, you’ll need to select one of these scripts and add them into your header tags. But, don’t forget to create a data file or a text file for blocking your offending spammers or hackers.
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipArray = preg_replace("#\r\n?|\n#","",file('IP.dat',FILE_IGNORE_NEW_LINES));
foreach ($ipArray as $ipTest) {
if (substr_count($ip, $ipTest) != "0") {
header('location: http://google.com'); // the banned display page
die();
}
} ?>
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipArray = preg_replace("#\r\n?|\n#","",file('IP.txt',FILE_IGNORE_NEW_LINES));
foreach ($ipArray as $ipTest) {
if (substr_count($ip, $ipTest) != "0") {
header('location: http://google.com');
die();
}
} ?>
2.] Save your changes and keep an eye for more spammers!
3.] Done!
Copyrighted By Lair360







I really like your blog and i respect your work. I’ll be a frequent visitor.
Thank you for registering! Feel free to read more if you have the time!