miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Banning users from posting only using Apache's .htaccess

Author hugh
Registered
#1 | Posted: 15 Apr 2005 14:18 | Edited by: hugh 
I would like to use Apache mod_rewrite to be able to ban a user from posting but not from reading the forums (using IP address). To do this I neet to know the commands that the "Post topic" and "Post reply" buttons send to the server. Can you tell me? I am using MiniBB 1.7.

Author Team
8-)
#2 | Posted: 15 Apr 2005 14:30 
I didn't understand why mod_rewrite matters here; but in general, look for /* Banned IPs/IDs stuff */ in index.php - you need to move this condition much below the code, where $action is defined, and check for banned IP and $action together.

Author hugh
Registered
#3 | Posted: 15 Apr 2005 14:41 
I can do it in a couple of lines in mod_rewrite without touching your code, I could redirect particular IPs to custom pages etc. I just need to know the commands that the "Post topic" and "Post reply" buttons send to the server. Thanks.

Author Team
8-)
#4 | Posted: 15 Apr 2005 14:58 
They send via POST method $action variable - with values either 'ptopic' or 'pthread'.

Author Team
8-)
#5 | Posted: 15 Apr 2005 14:59 
It would be cool to see these "couple of lines" here - another users could find it useful too. Thanks.

Author hugh
Registered
#6 | Posted: 15 Apr 2005 15:11 
Thanks for the info. I'll post the code when I've tested it.

Author hugh
Registered
#7 | Posted: 15 Apr 2005 17:22 
It turns out I'm not able to redirect to any page I choose but this will deliver a custom error page to forum visitors forbidden from posting but who will still be allowed to read.

WARNING: This is not for everyone. You have to be running Apache. .htaccess and mod_rewrite are very powerful and unforgiving. One typing mistake and you can ban everyone from your site. You have to ftp the .htaccess file to the server every time you change it. I'm only going to use this myself for forum visitors who are misbehaving but who I think I can persuade to behave properly.

I made a custom error page explaining the temporary ban - 403.html - and uploaded it to the forum directory.

I made a .htaccess file as follows and uploaded it to the forum directory (the file is named .htaccess - with a dot in front and no file extension). Replace 00.00.00.00 with the banned IP addresses, you can have as many as you want separated by [OR] as below. If you only have one, put it on one line without the [OR]. Change the path on the last line to the path to your error document if necessary.

# begin .htaccess file
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REMOTE_ADDR} ^00.00.00.00$ [OR]
RewriteCond %{REMOTE_ADDR} ^00.00.00.00$
RewriteCond %{REQUEST_METHOD} POST
RewriteRule .* - [F,L]

ErrorDocument 403 /forum/403.html

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Banning users from posting only using Apache's .htaccess Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB