IP blocking

  • green-eyed
  • Newbie
  • Newbie
  • green-eyed
  • Posts: 9
  • Loc: PL

Post 3+ Months Ago

Hello,


I have a weblog, hosted on blogger (blogspot.com). Would like to get rid of some unwanted guests. I know their ip's.

Could anyone help to find the most effective solution ?

Please note that this is a weblog... so I cannot create folders, upload programs etc. - the only thing I can do is to modify the HTML template.

Are there any effective java scripts ? (I tried to use some, but they simply didn't work... )

Or whatever ... but HELP, please.

And btw - how can I make it impossible to connect to the site through a proxy ?


Thank you in advance.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

you could probably do something with javascript (like check their IP address and close it if matches one in your list of unwanteds. But your unwanted guests can dissable javascript so this would not be effective.....
  • green-eyed
  • Newbie
  • Newbie
  • green-eyed
  • Posts: 9
  • Loc: PL

Post 3+ Months Ago

Well, I have the following script :


Quote:
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
if (ip == '206.186.23.178') {
alert("STOP! You are viewing this page from an IP address that is not allowed!");
alert("Why can't you guys just leave me alone?");
if (confirm("Do you want to leave peacefully? Or will I have to help you?"))
{location.href="http://www.yahoo.com" } else { ("OK you choose I don't care! Bye bye! Don't come back!"); {location.href="http://www.yahoo.com" }} }
</script>



I pasted it into the template, and then blocked my own ip. It didn't work - I connect to the site without any problems.


Could you please tell me what's wrong with this script ?
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

There is no a real javascript solution to your problem. If they have a fixed IP, you can modify a PHP or Web-Server configuration. But I guess you can't do that.

The proxy question: it's impossible to archive that without PHP. And even with PHP it will be a slow solution.
  • green-eyed
  • Newbie
  • Newbie
  • green-eyed
  • Posts: 9
  • Loc: PL

Post 3+ Months Ago

So ... have to give up ?


And what do you think about it:

1) upload an ip-blocking program (in php) on my own server (lycos)

2) paste a redirection code into the weblog's template


The idea is that the guests trying to connect to my weblog are redirected to the php - file hosted on my server (supporting php) and then after the verification - depending on their ip - they get kicked out or come back to the blog ?

Would it work ?

If you think, it might work, tell me please, how the redirection link should look like (a code that I paste into the weblog's template).

Thanks in advance.
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

Turning off javascript, will take up to nine seconds to any guest willing of get to your weblog. Once javascript is off, the browser just ignores the script. Do you think it will work?

I don't think so. That's why I said there is no REAL solution with javascript. No matter the script you put in the weblog template.
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

Now, why don't you put your weblog into your own server?

I guess there are many free open source weblogs in PHP.
  • green-eyed
  • Newbie
  • Newbie
  • green-eyed
  • Posts: 9
  • Loc: PL

Post 3+ Months Ago

"...was blind, but now I see" :)

Thanks.

Yes I know I can host my blog on a free server. But - I don't find them reliable. You know what I mean ? They go up and down, they're slow and so on ... Blogger offers a very good hosting, I must admit.
  • green-eyed
  • Newbie
  • Newbie
  • green-eyed
  • Posts: 9
  • Loc: PL

Post 3+ Months Ago

On the other hand - I would never even suspect that it is so difficult to block someone ...
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

Well, it is virtually impossible, even in your own webserver. Most ISP use a dynamic IP scheme where the IP given to a specific user changes every time he logs on.
  • Managedlinks
  • Proficient
  • Proficient
  • Managedlinks
  • Posts: 294

Post 3+ Months Ago

It can be done, using a server side script such as perl or php

the problem of dynamic ip address can be resolved by blocking IP blocks

This unfortunately could lock out large swathes of potential readers

the solution to the problem is probably hidden in WHY you want to block particular ip's.

given that, a suitable solution is just waiting to be found.

P.S. the reason why your script did not work is because you embedded a SSI command in it. but your page is not .shtml therefore SSI does not work.
  • Black_Legon
  • Beginner
  • Beginner
  • Black_Legon
  • Posts: 35
  • Loc: Netherlands

Post 3+ Months Ago

you cant make a blok system with javascript. you can always pass that.
The only way to do so is with a server side language. Like ASP,PHP,PERL.

here a script that you can use...

PHP Code: [ Select ]
 
<?
 
// Copyright (c) 2003-2004 Black_Legon.)
 
// ALL RIGHTS RESERVED (<!-- m --><span class="postlink">http://www.atlantisthegame.com</span><!-- m -->)
 
 
 
$bmode = 1;
 
 
 
// $block ip is the IP of the person that you wish to block.
 
// You can add as many IP's as needed but keep the same format.
 
// The last IP will not need a ',' after it. The others will.
 
 
 
$blockip = array("216.254.16.21",
 
                 "2.2.2.2",
 
       "3.3.3.3"
 
                 );
 
 
 
 
 
 
 
// $blockmsg is the message the user will see if they are blocked.
 
//
 
// Example:
 
 
 
 
 
$blockmsg = array("1.1.1.1 is not allowed.",
 
                  "2.2.2.2 Blocked for forums abuse.",
 
                  "3.3.3.3 We are temporarily down."
 
                 );
 
 
 
// Don't add this.
 
 
 
$x = count($blockip);
 
 
 
for ($y = 0; $y < $x; $y++) {
 
  if ($bmode == 1 && $REMOTE_ADDR == $blockip[$y]) {
 
     exit($blockmsg[$y]);
 
  } else if ($bmode == 0 && $REMOTE_ADDR == $blockip[$y]) {
 
    break;
 
  }
 
}
 
 
 
?>
 
 
  1.  
  2. <?
  3.  
  4. // Copyright (c) 2003-2004 Black_Legon.)
  5.  
  6. // ALL RIGHTS RESERVED (<!-- m --><span class="postlink">http://www.atlantisthegame.com</span><!-- m -->)
  7.  
  8.  
  9.  
  10. $bmode = 1;
  11.  
  12.  
  13.  
  14. // $block ip is the IP of the person that you wish to block.
  15.  
  16. // You can add as many IP's as needed but keep the same format.
  17.  
  18. // The last IP will not need a ',' after it. The others will.
  19.  
  20.  
  21.  
  22. $blockip = array("216.254.16.21",
  23.  
  24.                  "2.2.2.2",
  25.  
  26.        "3.3.3.3"
  27.  
  28.                  );
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. // $blockmsg is the message the user will see if they are blocked.
  37.  
  38. //
  39.  
  40. // Example:
  41.  
  42.  
  43.  
  44.  
  45.  
  46. $blockmsg = array("1.1.1.1 is not allowed.",
  47.  
  48.                   "2.2.2.2 Blocked for forums abuse.",
  49.  
  50.                   "3.3.3.3 We are temporarily down."
  51.  
  52.                  );
  53.  
  54.  
  55.  
  56. // Don't add this.
  57.  
  58.  
  59.  
  60. $x = count($blockip);
  61.  
  62.  
  63.  
  64. for ($y = 0; $y < $x; $y++) {
  65.  
  66.   if ($bmode == 1 && $REMOTE_ADDR == $blockip[$y]) {
  67.  
  68.      exit($blockmsg[$y]);
  69.  
  70.   } else if ($bmode == 0 && $REMOTE_ADDR == $blockip[$y]) {
  71.  
  72.     break;
  73.  
  74.   }
  75.  
  76. }
  77.  
  78.  
  79.  
  80. ?>
  81.  
  82.  


Hope you can use this.
  • Black_Legon
  • Beginner
  • Beginner
  • Black_Legon
  • Posts: 35
  • Loc: Netherlands

Post 3+ Months Ago

and over that ip problem...
PHP Code: [ Select ]
 
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
 
   if ($_SERVER["HTTP_CLIENT_IP"]) {
 
    $proxy = $_SERVER["HTTP_CLIENT_IP"];
 
  } else {
 
    $proxy = $_SERVER["REMOTE_ADDR"];
 
  }
 
  $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
 
} else {
 
  if ($_SERVER["HTTP_CLIENT_IP"]) {
 
    $ip = $_SERVER["HTTP_CLIENT_IP"];
 
  } else {
 
    $ip = $_SERVER["REMOTE_ADDR"];
 
  }
 
}
 
 
  1.  
  2. if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
  3.  
  4.    if ($_SERVER["HTTP_CLIENT_IP"]) {
  5.  
  6.     $proxy = $_SERVER["HTTP_CLIENT_IP"];
  7.  
  8.   } else {
  9.  
  10.     $proxy = $_SERVER["REMOTE_ADDR"];
  11.  
  12.   }
  13.  
  14.   $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
  15.  
  16. } else {
  17.  
  18.   if ($_SERVER["HTTP_CLIENT_IP"]) {
  19.  
  20.     $ip = $_SERVER["HTTP_CLIENT_IP"];
  21.  
  22.   } else {
  23.  
  24.     $ip = $_SERVER["REMOTE_ADDR"];
  25.  
  26.   }
  27.  
  28. }
  29.  
  30.  


This script can get almost every ip.

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 134 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.