PDA

View Full Version : How to ban an IP


Jen
11-16-2004, 06:02 PM
I use blogspot.com to host my blog and I'm having problems with a person who's been copying my work and claiming it as their own. I've been searching for a way to block this person's IP from being able to view my blog but everything I've seen says I need to create a php file and upload it and then direct hits from that IP to that page.

I don't have my own domain server and I don't know of any free hosts like geocities that allow php files.

Anyone know of a code that will work in a blogger template to ban an IP?

webado
11-18-2004, 04:00 AM
OK, I have a script that you may be able to use in the blog, though I haven't tested it there yet.

it will work as long as Blogpot poermits SSI (server side includes). If it doesn't then you cannot use it there.

Copy this code into Notepad and modify the IP addresses you need to ban. Save it unser some name.txt. Copy the newly saved code entirely and paste it as close to the top of your Blog template as you can, making sure you don't mess up the template code.

If it doesn't work, you'll have to remove it completely from your template.

Good luck.


<script language="JavaScript" type= "text/javascript" >
// Script for visitor banning by IP address.
// **** by www.webado.com ****

// May be placed in the head or in the body segment of an html page.
// Always use Notepad or another plain text editor, not a WYSIWYG editor unless you work in code view mode.

// Since this script uses SSI, the web page may have to be named with the extension shtml instead of html or it will not work,
// unless the server allows SSI to be used in ordinary html pages.
// Please not that the nature of SSI makes it impossible to turn this into a javascipt source, you must include everything.

// Put in the address to which you want to redirect if the user is banned
// it may be a page on your site or the url of another web site that exists
// the url given below is just an example, as good as any

var banned_ip_page = "http://www.google.com"; // This is the page to direct to if the ip is banned


// get the visitor's IP address

var visitor_ip = ''; // This is the visitor's IP address as returned by the server


// User defined test - add as many groups as you need for all the banned ips;
// Make sure you modify these example ip addresses and do not lock yourself out.
// The || (vertical bars or pipe lines) mean "or" and the == is used to test equality
// Each individual test is enclosed in parentheses
// The entire set of tests is enclosed in parentheses

if ( // opening parenthesis for the entire test

// You may change the tests from here
(visitor_ip == "000.000.000.000" )
|| (visitor_ip == "111.111.111.111" )
|| (visitor_ip == "222.222.222.222" )
// until here

) // closing parenthesis for the entire test
{ alert("Sorry, your IP has been banned from this site");
document.location = banned_ip_page; }

</script>


---- EDIT ---

Unfortunately this does not work on Blogspot :cry: because of the lack of SSI support. Not much that can be done unless you can persuade Blogger to permit SSI, and that's not likely to happen.

am4606hos
12-01-2004, 03:53 AM
I have the same problem with two individuals copying information that is listed on my Geocities webpage and my Yahoo group. Since I have StatCounters on both my sites, I would love to have the option to block specific IP addresses from viewing my sites.

webado
12-01-2004, 04:25 AM
I have the same problem with two individuals copying information that is listed on my Geocities webpage and my Yahoo group. Since I have StatCounters on both my sites, I would love to have the option to block specific IP addresses from viewing my sites.
You can us this script on your web pages stored on a geocities account, but you have to reanem the pages to .shtml rather than .html or .htm . If Geocities does not support SSI, you're out of luck.

Yahoo groups, no idea, as I replied to your other post.

enviroman
01-14-2007, 09:31 AM
Here is a post that shows how you can ban IP addresses from Blogger blog
http://blogger-tricks.blogspot.com/2006/10/how-to-ban-person-from-your-blog-or.html

Peter

(An online book in progress)

webado
01-14-2007, 04:34 PM
Not just for blogger blogs, but still requires javascript on the visitor's end (which can be disabled at will) and of course ability to use javascript on the website.

I guess it's a kind of a last ditch effort.

Thanks for this tip.

jamesmadison
11-22-2008, 12:32 AM
I have had visitors come back even after I banned them cause they were using a proxy service from blackhatip.com . You can always find the new ip addresses linking back to their proxy servers, but it is a pain to keep banning, anyone know how to automate this process?

webado
11-22-2008, 01:18 AM
Old thread.

And no you cannot do it in an automated way, you need to know what it is you are banning.

You can try to block proxy access, but detection of a proxy is tricky and not perfect. Some will slip right through, other times legitimate visitors end up blocked because of using special internet connections (e.g. satellite, institutional proxies) that have the same footprint as any other kind of anonymizer proxy.

Personally I block anyhting that looks like a proxy and take care of exceptions separately.