Create a file called banned.php containing this:
Replace the 0's with the IP address you want to ban.<?php
$ip = getenv('REMOTE_ADDR');
$email = "email@server.com"
$ban1 = "000.000.000"
$ban2 = "000.000.000"
$ban3 = "000.000.000"
$ban4 = "000.000.000"
$ban5 = "000.000.000"
$ban6 = "000.000.000"
if($ip == $ban1 || $ip == $ban2 || $ip == $ban3 || $ip == $ban4 || $ip == $ban5 || $ip == $ban6)
{
echo "You have been banned from this website. To appeal this ban, contact the webmaster at $email."
exit;
}
?>
Add the this code to all the pages on you're site you want this to apply to.
( Make sure the file extension of the page is .PHP | Example = index.php )
The code should now work, now to explain the code:<?PHP
include("banned.php");
?>
$ip = getenv('REMOTE_ADDR'); - I am assigning the person's IP to the variable $ip. $ip is used when checking the IP against the banned list.
$email = "email@server.com" - Change email@server.com to your e mail so people can contact you regarding the ban.
$ban1 = "000.000.000" - Change the 0's to the person's IP you wamt to ban. That assigns the banned IP to the variable. It is the same with ban1 to 6
if($ip == $ban1 || $ip == $ban2 || $ip == $ban3 || $ip == $ban4 || $ip == $ban5 || $ip == $ban6) - Checks the $ip variable against a list of banned ip's. If it matches, it echos and the user cannot view the site. However, if it does not match any IP on the list of banned IP addresses the user can view the webpage normally.
If you want to ban anymore IP's, add another line to the banned list. (Remember to change the number)
Then, edit the if statement.


LinkBack URL
About LinkBacks
Reply With Quote
(at the corner of this post) & make me
-it costs you nothing!







