How to BAN IPS real fast!!!
Date: Saturday, December 13 @ 14:29:19 CET
Topic: Security


Since they tried to hack me this morning and are trying ...
i made a banscript real fast ,if u need it just copy and paste the code below in your header.php
and make a txt file called banned.txt with an ip on each line.
so like
127.0.0.1
127.0.0.2
ok.
open header.php and all above just under the
paste this code:

if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif (isset($_SERVER['HTTP_VIA'])) {
$ip = $_SERVER['HTTP_VIA'];
}
elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
else {
$ip = "Banned";
}

$banned = file("banned.txt", "r+");
$nbanned = count($banned);
function ban($ip, $banned, $nbanned){
for ($i = 0 ; $i You Have been banned from this portal, if you feel this is in error
please send email to you@yoursite.com ";
die();
}
}
}
ban($ip, $banned, $nbanned);

i m using it myself too at the moment!hehe






This article comes from NukeCops
http://www.nukecops.com

The URL for this story is:
http://www.nukecops.com/modules.php?name=News&file=article&sid=1161