Kick those spammers and give them a red ticket!




Tagged Under : , , , ,

Version: 13.1c
Revision: 11 Build 31

Kick those spammers and give them a red ticket!

Introduction:
for the last three days, I was banging my head against the monitor – trying to create a powerful – php script that could block a bunch of idiotic spammers, by range.
But, here is the good news… you can use this script without any faults – from a single directory! This means, your “IP text file” can be placed into the same directory without writing its TRUE directory.

In this script you’ll only need to modify two lines: the url directory and the warning message for the naughty spammers. Also, if you want to use the “banned_warning” strings, you will need to keep the “banned_url”, empty.

Finally, before you use this script, the structure of the “IP address” file cannot have white spaces from the beginning, middle and the end. Also, the supported range are limited. It can only recognize these structure…

123.
123.56.
123.56.76.
123.56.76.44
255.255.255.255
0.0.0.0

1.] Login to your Cpanel and add this to the “header.php” file.

Notes: if you want to make this script as an “Include” file, then you’ll need to use this code. Just place this lines into your “header.php”. But, you must type the paths, clearly. Or else, there will be errors / faults with your Website.

<?php include ($_SERVER['DOCUMENT_ROOT']."/diectory-one/banned.php"); ?>

- replace the default directory (“/diectory-one/banned.php”) with your own directory that has the “blocking IP script”.

<?php
// Version: 13.4 Eagle
// Copyrighted By Lair360
// --------------------------------
$filelocation = "ips_blocker.txt";
$banned_warning = "You're banned from Spamming my website!
<br>If you are blocked by mistake, please contact the admin: [Email Address]";
// Url redirects ++ leave blank to use banned_warning ++
$banned_url = "";
// Modifications stops here!
function ShowBan() {global $banned_url, $banned_warning; if ($banned_url == "") exit($banned_warning);
  else header("Location: $banned_url"); exit;}
if ($_SESSION_['banned'] == 'TRUE') ShowBan();
// comment out the "Session" if you're using the include function.
	if (!isset($_SESSION)) session_start();
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
	$banfile = file($filelocation);
foreach ($banfile as $list)
    {
        $list = rtrim($list); // trim the junk that is killing your website!
        if (strstr($ip, $list) && strpos($ip, $list)==0)
            { $_SESSION_['banned'] == 'TRUE';
                ShowBan();}
    }?>

2.] Save your file and input your offending IP addresses into your text file. But, don’t be a fool and block yourself from accessing your website, especially, adding the IP range.

3.] Finish!

Copyrighted By Lair360




Restrict certain hosts or IP address




Tagged Under : , , ,

Version: 12.4
Revision: 45 Build 68

Restrict certain hosts or IP address

Introduction: this tutorial will help user to block bad hosts and IP address from tampering your website. On the other hand, you will need to be careful with your .htaccess file – configurations; if you set one of the commands by mistake, your browser will generate a blank page with an Error 404 or 500.

1.] Download notepad++ from the original author or from a mirror and install the software.

——————————-

http://sourceforge.net/projects/notepad-plus/

http://filehippo.com/download_notepad/

——————————-

2.] Copy this code to your notepad and save the source code as “.htaccess”.

This source code is use to block everyone and it will only allow certain host / IP address to access.

Warning: you must be careful and test your htaccess file in a sub folder.
A slight mistake will also block you and your entire website!

Notes: Limit Get Post is defined as…
- limit the IP ban (users) to GET requests and POST actions.

—Copy Source Code—

<Limit GET POST>
order deny,allow
deny from all
allow from 199.166.210.55
allow from 199.166.120.22
allow from allowdomain1.net
allow from allowdomain2.net
allow from allowdomain3.net
</Limit>

—End Source Code—

This source code is a little different. But, it will allow everyone and it will only block certain host / IP address to access.

—Copy Source Code—

<Limit GET POST>
order allow,deny
allow from all
deny from 199.166.210.55
deny from 199.166.120.22
deny from denydomain1.net
deny from denydomain2.net
deny from denydomain3.net
</Limit>

—End Source Code—

This source code is the same and it also performs the same job…

Notes: Limit Get is defined as…
- limit the IP ban (users) to GET requests.

—Copy Source Code—

<Limit GET>
order deny,allow
deny from 63.135.80.49
deny from 208.75.184.192
deny from denydomain1.net
deny from denydomain2.net
deny from denydomain3.net
allow from all
</LIMIT>

—End Source Code—

This source code is the same as the above. But, it blocks everyone and allows certain host / IP address to access.

—Copy Source Code—

<Limit GET>
order allow,deny
allow from 63.135.80.49
allow from 208.75.184.192
allow from allowdomain1.net
allow from allowdomain2.net
allow from allowdomain3.net
deny from all
</LIMIT>

—End Source Code—

This source will also do the trick. However, it’s a little more strict…

—Copy Source Code—

<Limit GET HEAD POST>
order deny,allow
deny from 128.42
deny from 192.136.146
deny from 192.136.153
deny from 192.225.19
deny from denydomain1.net
allow from all
</LIMIT>

—End Source Code—

To block users from looking at your htaccess files, you can use this source code…

—Copy Source Code—

<Files .htaccess>
order allow,deny
deny from all
</Files>

—End Source Code—
Copyrighted by Lair360