Khalil
IDK
Hello everyone, just tought i'd share this small script i found ealier, and using for
So, the code is (you may just put this as ban.php in your functions file and then use the include function to include it into the page):
Then go to your index page or home page, and just include this simple line:
Hope you guys like it, if you have any problems with it just pm me pr reply to this thread.
-Khalil
You must be registered for see links
.So, the code is (you may just put this as ban.php in your functions file and then use the include function to include it into the page):
PHP:
<?php
$ip_ban_array = array(
'FIRST IP',
'SECOND IP',
'THIRD IP'
);
$hostname_ban_array = array(
'HOSTNAME-1',
'HOSTNAME-2',
'HOSTNAME-3'
);
function check_ban() {
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "0.0.0.0";
$host = gethostbyaddr($ip);
$ip_ban_array = array(
'AN IP TO BAN HERE'
);
$hostname_ban_array = array(
'eu.tachyon.net',
'ttnet.net.tr',
'meteksan.net.tr',
'metu.edu.tr',
'doruk.net.tr',
'belbone.be',
'skylogicnet.com',
'telsim.com.tr',
'titannetworks.nl'
);
if (is_array($ip_ban_array)) {
if (in_array($ip, $ip_ban_array)) {
die("Your ip have been banned from the website.");
}
}
if (is_array($hostname_ban_array)) {
foreach ($hostname_ban_array as $ban_host) {
if (preg_match("/".$ban_host."\b/i", $host)) {
die("Your Hostname is banned!");
}
}
}
}
?>
Then go to your index page or home page, and just include this simple line:
PHP:
<?php check_ban() ?>
Hope you guys like it, if you have any problems with it just pm me pr reply to this thread.
-Khalil