Help setting up a Ban screen (9)

1 Name: np3228!tpHARBLZ0A : 2008-01-06 16:13 ID:WczJ9PmM [Del]

Hi all,

I've looked through all the topics on this board and find that this topics hasn't been covered yet, hence the new thread.

I've been using the Kareha script much to my delight for over a year now. I'm quite pleased with the results. It's very sleek and elegant for an imageboard or text board without the need for a database backend.

That said, my question is: how might one set it up so that when a person's IP is added to .htaccess (eg. Deny from 127.0.0.1) it shows up with a ban screen that simply states the reason they were banned and possibly a novel picture.

I'm thinking of a layout similar to the error screens from "This thread is closed" and "This file has already been posted here" from templates.pl

2 Name: Anonymous : 2008-01-06 19:30 ID:Heaven [Del]

>>1 sounds like a job for mod_rewrite (assuming you're on an apache-or-compatable server)!

http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

3 Name: !WAHa.06x36 : 2008-01-06 20:00 ID:Heaven [Del]

I've never tried setting this up myself, but I know others have, with mod_rewrite tricks.

4 Name: np3228!tpHARBLZ0A : 2008-01-07 04:09 ID:WczJ9PmM (Image: 428x385 gif, 3 kb) [Del]

src/1199707774432.gif: 428x385, 3 kb

>>2>>3

I think that's enough to get me started. Thanks!

5 Name: Anonymous : 2008-01-07 20:08 ID:Heaven [Del]

Eh, people get all caught up in using mod_rewrite for situations like this where there's a much simpler way to do it.
I've found a simpler solution is to have a 403 page defined in a .htaccess within the board's directory. (I moved the .htaccess bundled with Kareha into my site's toplevel directory, rather than duplicating it everywhere.) Supposing you were making such a setup for this board, this would go into htdocs/sup/.htaccess:

ErrorDocument 403 /banned.html
Order deny, allow
Deny from 64.191.203.30

... and so forth for each ip you want to ban from reading the board.

Then you could add something like this to do_ban in admin.pl:

open HTACCESS, ">>", ".htaccess" or die "Could not open .htaccess for writing";
print HTACCESS "# $reason\nDeny from $ip\n";
close HTACCESS;

It would be more useful (although considerably more in-depth as well) to add a couple radio buttons to the admin panel to do this: "ban from viewing board" vs. "ban from posting only".

6 Name: !WAHa.06x36 : 2008-01-08 09:27 ID:Heaven [Del]

>>5

Why would you add that? All the code to do that is already in place.

7 Name: Anonymous : 2008-01-09 06:50 ID:Heaven [Del]

>>6
Ah, so it is. I guess I added the ban-from-posting-only section, then. My mistake for not checking the release version first.

8 Name: Anonymous : 2008-01-24 13:08 ID:u3+l4t+c [Del]

>>6
Excuse me, i've also made my bans this way but i couldn't find this code that you speak of. I'm using wakaba 3.0.7.

Is it only in kareha?

9 Name: !WAHa.06x36 : 2008-01-24 18:07 ID:Heaven [Del]

>>8

Yes.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: