[Home]WikiPatches/SelfBan

UseModWiki | WikiPatches | RecentChanges | Preferences

This patch will ban the IP address of anyone loading it. See MeatBall:SelfBan for a discussion. /OpenProxy depends on this.

WARNING: It's important to set the $SelfBan? parameter to something unique and secret.


First, add $SelfBan? to the configuration variables list at the top of the file.

Add the following two lines to DoOtherRequest.

    } elsif( $action eq $SelfBan ) {
      &DoSelfBan();

Add the following function

sub DoSelfBan {
  print "Content-type: text/plain\n\n";
  print "Congratulations, you have banned your own IP!";

  my $banlist = ReadFile("$DataDir/banlist");
  my $date = &TimeToText($Now);

  $banlist .= "# self-ban on $date\n^$ENV{REMOTE_ADDR}\n\n";

  WriteStringToFile("$DataDir/banlist", $banlist );
}

-- SunirShah


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited January 27, 2008 8:23 pm by JuanmaMP (diff)
Search: