Click to See Complete Forum and Search --> : Ban!


Jonathan
07-13-2003, 08:25 PM
How can I ban an IP address??

brendandonhue
07-13-2003, 09:44 PM
What language? PHP?
If its just 1 address try
$ip = $_SERVER['REMOTE_ADDR'];
$banned = "banned_ip";
if ($ip == $banned)
{echo("Your IP has been banned");}

Jonathan
07-13-2003, 11:32 PM
So where do I put the IP address?

brendandonhue
07-13-2003, 11:48 PM
$banned = "banned_ip";
would be
$banned = "68.40.91.144";
to ban 68.40.91.144

Jonathan
07-13-2003, 11:54 PM
So where would I put this script?

brendandonhue
07-14-2003, 12:05 AM
Never mind,theres an error in the script!
$ip = $_SERVER['REMOTE_ADDR'];
$banned = "banned_ip";
if ($ip == $banned)
{header('location:banned.html');}

Then create a file called banned.html with a little message saying they are banned.
It goes at the top of the page, in <?php and ?> as all PHP code does..

Jonathan
07-14-2003, 12:17 AM
cool, can I also put it in a form? The feedback.php part?

Jonathan
07-14-2003, 12:19 AM
ANd... how would I ban more IP addresses?

$ip = $_SERVER['REMOTE_ADDR'];
$banned = "banned_ip";
$banned2 = "banned_ip2";
if ($ip == $banned || $ip == $banned2)
{header('location:banned.html');}