1. Create a file called ban.php and add this sctip to it.
PHP Code:
<?php
// For a single user ban
$ban_ip = 'xxx.xxx.xxx.xxx'; // ip address of the person you want to ban
// DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING
$visitor_ip = $_SERVER['REMOTE_ADDR']; // the ip address of the visitor
if($visitor_ip == $ban_ip)
{
die("You are banned from this site!");
}
// DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING
$visitor_ip = $_SERVER['REMOTE_ADDR'];
$ip_list = explode(",", $ban_ip);
foreach($ip_list as $ip)
{
if($visitor_ip == $ip)
{
die("You are banned from this site!");
}
}
?>
2. Add this code to any page you what the ip banned from
PHP Code:
<?php
include('ban.php');
?>