Jump to content

Banning IP Addresses

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
hey does anyone know where to get a script to ban someone from entering your site with there i.p.? i've looked all over for somthing it but cant find anything thanks

#2
Guest_WebScott_*

Guest_WebScott_*
  • Guests
Try this:

<?php
$badIP = '123.123.123.123';

if($_SERVER['REMOTE_ADDR'] == $badIP) {
header('Location: goAway.htm');
}
?>

You'll need to include this on every page using this method through PHP. However, I suspect there's an easier way to block someone using htaccess, assuming you're using apache.

#3
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
Thank you WebScott! I can create this as a function in a seperate php file and then include it in every webpage I have. This will work perfectly I think.

I haven't found a way to block using apache although I haven't looked into it that much.

#4
Guest_cpvr_*

Guest_cpvr_*
  • Guests
It can also be down via cpanel, just ban the ip using the domain ban thingy.

#5
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Yes, plesk also has a feature to block IPs.