IP Blocking Super Script

access denied ip blocking IP Blocking Super ScriptRecently we were talking with a customer about a situation where they were having a competitor continually visiting their site to get ideas. They wanted to block them via an IP blocking script which we assisted in cobbling together. Before we delve into the code, let’s talk about some considerations about IP scripts in general. Most importantly, we wanted to state our strong opinion that a website should never be obvious in Geo Targeting. Sure its easy to get an IP, but why should you bother in telling the user? Personally, I find sites that do this creepy and really not having a good grasp of marketing? Why do you want to make your customers users feel like you are spying on them? If you need to Geo target make it seamless. Move a customer to the content for them but there is no need to pound your chest and say look at me with a message that says: “Hi. We see you’ve come from this IP and you live in Timbuktu.”

Okay, so onto the wonderful world of IP Blocking. Here is a simple and easy code to block some one from your site right away:

<?php
$denyIP = array("IP Address 1", "IP Address 2", "IP Address 3");
if (in_array ($_SERVER['REMOTE_ADDR'], $denyIP)) {
header("location: http://www.mark8t.com/");
exit();
} ?>

This script will block the users listed and automatically redirect a user to mark8t.com. Just as easy it is to implement, it is easy to bypass using a proxy server/different location. However, it should keep out most people with little technical skill or know-how. To really block someone we suggest the below tips which we call our IP Blocking Cheat Sheet:

1- Place the script on the main page, and call to it on all pages, through an page at a secure https page. The reason you want to do this is most free proxies will not allow a user to access a secured page without paying.
2- Some people will use Google Translate or Google Cache to access your site. To avoid that add a frame breaking code to your script, so the IP Blocking script will load.
3- To avoid people from accessing the site via Google Cache or Archive.org, you should add the meta tag for no archive
4- Mistakes happen so offer a user a way to report if they feel there is an error, so they can be removed from the ban.

We have combined all the above into Mark8t’s Super IP Blocking Script. It’s free to use, so play around with it. You can call it to every page via a PHP include function or just place on the index. It’s really up to you. Just make sure you include the above elements for the most success. Nevertheless, we also offer the following disclaimer: if someone really wants to visit your site, no IP ban or block script will work. People can use paid proxy server solutions or use another computer at a different location. If you don’t want your content accessible to the public don’t place it on the web. Have fun!

Print This Post Print This Post
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>