Forums

Join
bbPress Support ForumsInstallationPassword Protect Directory Using PHP

Info

Password Protect Directory Using PHP

  1. 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

  2. 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.

  3. 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

  4. 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! ;-)

  5. 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 :)

  6. 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?

  7. 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.

  8. 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. =)

  9. 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

  10. You would get into a redirection loop with that. Add a filter to ignore bb-login.php in the if and it should work.

  11. 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 :)

  12. @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. :-)

  13. pagal and Kevinjohn - please take your personal discussion off list. It really doesn't belong here.

  14. 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"

  15. The easiest way to protect with .htaccess

  16. @gordonsa thanks dear,
    I definitely know that the easiest way to protect with .htacess. but again

    I 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...

    e.g. This wordpress plugin

  17. You must log in to post.