-
Here is a code that will ban users with the specified ip, or multiple IP's in PHP, this goes at the very top if you want to prevent them from viewing:
1. Single IP:
<a href="http://ipost2host.com/viewtopic.php?f=14&t=1719#" target="_blank">
</a>
Code:
<?php
function block_ip($ip){
if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip)) == $ip){
return true;
} else {
return false;
}
}
// check if ip is blocked
if (block_ip("123.456.789.987")){
echo 'go away';
exit;
}
?>
Block IP range:
<a href="http://ipost2host.com/viewtopic.php?f=14&t=1719#" target="_blank">
</a>
Code:
<?php
function block_ip($ip){
if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip)) == $ip){
return true;
} else {
return false;
}
}
// check if ip is blocked
if (block_ip("123.456.") or block_ip("123.457.")){
echo 'go away';
exit;
}
?>
Instead of blocking 1, you can lso use this instead of if:
<a href="http://ipost2host.com/viewtopic.php?f=14&t=1719#" target="_blank">
</a>
Code:
if (block_ip("123.456.") or block_ip("123.457.")){
notice how it has an or then the same code again, so you may block mulitle IP addresses
-
its use it at script
but i think its prefer banning him by htaccess(cpanel , manualy)