Info
- 16 posts
- 5 voices
- Started 1 year ago by Pagal
- Latest reply from Pagal
- This topic is not a support question
Password Protect Directory Using PHP
-
- Posted 1 year ago #
Hiya,
I don't want to use .htacess method, I want to use php
Is there any way to protect a directory/folder with password using php?
Suppose I want to protect my forums directory ( just show user/pass)
http://www.example.com/forums
Thanks -
- Posted 1 year ago #
Why not using
.htaccess? It's easy!By "I want to protect my forums directory", do you mean you want to turn all your forums private? If so, use this plugin.
-
- Posted 1 year ago #
thanks pelle :)
I know very well .htacess really easy, but for some reasons, I don't want to use it.
Second your plugin also great, but need some functionalities, can you update it?I need following action,
Complete protection not even show
bb-login.php
bb-reset-password.php
register.php
xmlrpc.php
bb-admin/
rss/there should just a protect.php page for asking user name and password, If i enter correct user, pass then the forums should display, then I can access the bb-login.php and other Swirl-immune pages. otherwise not!
Thanks
-
- Posted 1 year ago #
Just remove the pages you do not need from
swirl-unknowns.php: lines 72-77. You may add pages too.Remember, though, that you'll NEED bb-login.php to be swirl-immune in order to actually be able to access your forum! ;-)
-
- Posted 1 year ago #
Oops! you are still confuse to understand my question :)
I also know very well that bb-login.php need for access the forums.
Let me tell you!
I've deleted the
bb-reset-password.php
register.php
xmlrpc.php
bb-admin/
rss/
from swirl-unknowns.php: lines 72-77.Then I add this code in template's login.php
http://pastebin.com/raw.php?i=MdzzJc3T
That what exactly I want :) -
- Posted 1 year ago #
I'm confused, does that mean you have what you want if you can link to it?
Or are you looking for someone to edit/duplicate a script you've found on the internet into a plugin for you?
-
- Posted 1 year ago #
kevinjohngallagher yep exactly,
http://pastebin.com/raw.php?i=MdzzJc3T
this script just protect web page not whole folder/directory.
I want to protect my whole forums directory!!
with user name / pass without using .htacess. -
- Posted 1 year ago #
In the script you linked, usernames and passwords are stored in clear in the php file: why do such a bad thing when bbPress has a database and encrypts passwords for you? Just login using its login form and that's it. =)
-
- Posted 1 year ago #
if (! bb_is_user_logged_in() ) { header( 'Location: bb-login.php' ); }Ok, so i'm guessing here, but whouldn't those 2 lines of code work?
btw, i used google and that solution was the first one, i'm just copy and pasting -
- Posted 1 year ago #
You would get into a redirection loop with that. Add a filter to ignore
bb-login.phpin theifand it should work. -
- Posted 1 year ago #
OFC!
Thats daft of me.if (! bb_is_user_logged_in() && basename($_SERVER['PHP_SELF'] != "bb-login.php") { header( 'Location: bb-login.php' ); }Pagal, please mate, i beg of you.
Google for 5 minutes before posting these requests and telling everyone they don't understand what you want, and never saying please or thank you.We want to help bro, help us by using Google first :)
-
- Posted 1 year ago #
@kevinjohngallagher which keyword you've used for google to find this solution?
Why are you begging? I did not send you invitation to help me!
Sorry I don't want to say any more, otherwise cris will close this topic. :-) -
- Posted 1 year ago #
pagal and Kevinjohn - please take your personal discussion off list. It really doesn't belong here.
-
- Posted 1 year ago #
May be my style of talking is different because of my bad English, Or My question presentation is not clear, but I don't want to hurt anyone or want to use bad words, that's why I always said "Please try to understand me"
-
- Posted 1 year ago #
The easiest way to protect with .htaccess
-
- Posted 1 year ago #
@gordonsa thanks dear,
I definitely know that the easiest way to protect with .htacess. but againI don't want to use .htacess method, I want to use php
Because sometime some scripts works with open directories. If I protect a directory via .htacess then this script or plugin will not work with this...
-
You must log in to post.