StatCounter User Forum  
StatCounter Free web tracker and counter

Go Back   StatCounter User Forum > Webmaster > Lounge (non-StatCounter related topics here!)

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 04-30-2005, 03:19 PM
Erika Erika is offline
Junior Member
 
Join Date: Feb 2005
Posts: 13
Default need help w/blocking IP addresses

Hi,

I use Blogger to run my weblog; I have to sign in to their site and all, directly. Anyway, it appears to be CSS coding in my template and I was wondering if there is any coding that I can add in to said template, that will block some IP addresses. I really don't now squat about this and my Google searches were incredibly confusing... It seems like a lot of people add the code to a directory, which I don't have as a Blogger user... Just my template. IS there another option that I could use?

Thanks, ahead of time!
  #2  
Old 04-30-2005, 04:06 PM
jonra01 jonra01 is offline
Master Member
 
Join Date: Feb 2005
Location: Mississippi
Posts: 3,636
Default block access to an ip address by javascript

Here's something that may work if they have javascript enabled, which they probably do. I don't know whether it will work on blogger, because it requires interaction with the server.

Copy and paste the script into the head of the page then change 'xxx.xxx.xxx.xxx' to their ip address. This script is only good for blocking one ip address. It would have to be modified if you wanted to block more than one. If you can't edit the head section of the page it can also be placed just after the opening body tag <body>

<script language="javascript" type="text/javascript">
<!--
var ip = '<!--#echo var="REMOTE_ADDR"-->';
if (ip == "xxx.xxx.xxx.xxx") {
alert("You are visiting this site from a blocked IP address " +ip);
window.location="http://www.aol.com"
}
// -->
</script>

John
__________________
John

Last edited by webado; 12-17-2005 at 07:36 AM. Reason: code got changed in forum conversion to VB
  #3  
Old 04-30-2005, 04:33 PM
Erika Erika is offline
Junior Member
 
Join Date: Feb 2005
Posts: 13
Default

Thank you!!

What about the aol.com line at the end? Why is that there? Does that need modification on my behalf?

I should also mentioned that I just signed up for the free version of Movable Type/Type Pad. Hopefully they'll let me have more entensive IP blocking capabilities...
  #4  
Old 04-30-2005, 04:53 PM
jonra01 jonra01 is offline
Master Member
 
Join Date: Feb 2005
Location: Mississippi
Posts: 3,636
Default

The aol reference is where the visitor is sent after the script checks their ip address. You can change this to anything you want as long as it is a valid web address.

John
__________________
John
  #5  
Old 05-01-2005, 01:09 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,147
Default

Quote:
Originally Posted by jonra01
The aol reference is where the visitor is sent after the script checks their ip address. You can change this to anything you want as long as it is a valid web address.

John
hmmmm... maybe even better if it's not a valid web adddresss .... gives them something to really cuss about
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
  #6  
Old 05-01-2005, 02:11 AM
jonra01 jonra01 is offline
Master Member
 
Join Date: Feb 2005
Location: Mississippi
Posts: 3,636
Default

Quote:
hmmmm... maybe even better if it's not a valid web adddresss .... gives them something to really cuss about
I thought about that, but since there is no error checking in this script I'm not sure they wouldn't just end up on a 404 page. If you really disliked them you could redirect them to a site like that one I posted the message about yesterday.

If you want to include more than one ip address you would change this in the script [code]if (ip == "xxx.xxx.xxx.xxx" || ip == "xxx.xxx.xxx.xxx")[/code]

For those not familiar with JavaScript, the vertical bars ( || ) are called pipes. Two of them together like this stands for the OR operand in JavaScript. You could include a few ip addresses this way.

John
__________________
John
  #7  
Old 05-01-2005, 05:29 PM
motorwatchercounter motorwatchercounter is offline
Master Member
 
Join Date: Sep 2004
Location: England
Posts: 1,364
Default

Send them to a site that you know contains trojans if you really don't like them.
__________________

I have no social life, I dribble a lot and forget things. By the way I dribble a lot and forget things. Now where was I??
  #8  
Old 05-26-2005, 10:57 PM
Erika Erika is offline
Junior Member
 
Join Date: Feb 2005
Posts: 13
Default

Thanks; now I know how to ban multiple addresses.
  #9  
Old 07-07-2005, 08:51 AM
motorwatchercounter motorwatchercounter is offline
Master Member
 
Join Date: Sep 2004
Location: England
Posts: 1,364
Default

Do you have access to a control panel with IP deny or access to allow a .htaccess file?
__________________

I have no social life, I dribble a lot and forget things. By the way I dribble a lot and forget things. Now where was I??
  #10  
Old 07-07-2005, 09:27 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,147
Default

Are you able to see that script exactly as entered in the body of your blog when you view the source?

You should post a link to your blog so we can take a look.

It's of course also possible that the visitor you are trying to ban has a different Ip address from what you are trying to block.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:05 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.