miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Banning users from posting only using Apache's .htaccess

 
Author hugh
Partaker
#1 | Posted: 15 Apr 2005 14:18 
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
Partaker
#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
Partaker
#6 | Posted: 15 Apr 2005 15:11 
Thanks for the info. I'll post the code when I've tested it.

Author hugh
Partaker
#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
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑