WordPress.org

Ready to get started?Download WordPress

Forums

Password Protect ENTIRE WordPress Site (20 posts)

  1. hevnsnt
    Member
    Posted 9 years ago #

    I am putting up a "Family" blog (My wife is pregnant) and she would like me to make the site Private, so you can only read the blog if you have a password.

    **HOWEVER** Grandma & Grandpa are going to be visiting the site, so I dont want to use a .htacess type solution (or have everyone login)

    Is there any way to make wordpress just go to a Password page, and if the correct password is given, it will take redirect and enable the normal blog?

  2. Denis de Bernardy
    Member
    Posted 9 years ago #

  3. hevnsnt
    Member
    Posted 9 years ago #

    I think *BOTH* of those require you to login... I dont want the users have to login, I just want a password, and once given will enable the entire blog.. Exactly what the first one does, but password based instead of login based. Again, I dont want to confuse Grandma & Grandpa...

  4. Joshua Sigar
    Member
    Posted 9 years ago #

    Just modify it so that the username is pre-filled-in and hide the input field.

  5. hevnsnt
    Member
    Posted 9 years ago #

    hahaha nice fix!

    Could you help me with that? I understand exactly what you are getting at, but could you help me with the code?

  6. plasticchicken
    Member
    Posted 9 years ago #

    Did you manage to do somthing like you want? I need the same thing as you. I am in the same situation with grandma and grandpa.

  7. tomhanna
    Member
    Posted 9 years ago #

    Color me dense but what's the difference between entering a password and logging in?

    And shouldn't we be giving Grandma and Grandpa a little more credit - surely they can remember how to login if they know how to type in the URL.

  8. plasticchicken
    Member
    Posted 9 years ago #

    The difference is I don't want to manage users. The password will be given to anybody. For instance, grandma could give the password to a friend so he/she can view the blog because I put pictures on the blog.

    The thing is I want to password-protect the site to avoir strangers to access the site. I don't care that a friend of a friend have the password to see the site, but I don't want any joe somebody that doesn't have a far relation with me or my familly to access it.

  9. oriecat
    Member
    Posted 9 years ago #

    You could password protect the WP directory through your CPanel, and then set up one user name and password to give out to folks.

  10. angsuman
    Member
    Posted 9 years ago #

    Even with .htaccess solution you can simply setup one set of login & password and give it out to everyone deserving.

  11. dummy
    Member
    Posted 9 years ago #

    Well, other than using sessions or cookies, you might tell grandma to go to http://myurl/wordpress/index.php?password=password, then in the index have it read the password and show nothing if it is not correct... then hide it somewhere on the page so it will be passed each page reload etc...I normally have a log in page with a session set, then check for that session each page load, but thats a little too complicated for this instance I think..
    most web sites will read the index.html first then the index.php, so you might make the index.html with javascript and tell grandma to click on pix one, then pix 5, then open the index.php.. ??? chances of a stranger or spider clicking on those two images in that order might be pretty low.

  12. Ming
    Member
    Posted 9 years ago #

    You can do alphaoide's solution by altering the username input box to this:

    <input type="text" name="username" value="insert_username_here" style="display: none;">

    Well, it'll be similar to that. The important parts are the value="insert_username_here" which makes that username the default value and `style="display: none;" which hides the input box. Of course you could put that rule into you CSS file too.

  13. pizdin_dim
    Member
    Posted 9 years ago #

    Even with .htaccess solution you can simply setup one set of login & password and give it out to everyone deserving.

    This sounds like the best approach to me. With .htaccess you password-protect the whole site with as few or as many usernames as you want to manage.

    Good one angsuman!

  14. dummy
    Member
    Posted 9 years ago #

    I must have been asleep when I posted above, wordpress does not interact well with passing variables, so I did this and it seems to work:
    put this in the beginning of the index.php, right after the php tag:

    $pass= $HTTP_COOKIE_VARS['pass'];
    if(md5($pass) !="6ac2ef13799089e8322ab4d07833321f") {
    header("Location: mylogin.php");
    }

    you do not have to hash it, you could use a plain password, just send them to mylogin.php if they don't have that cookie.
    then in mylogin.php, put this:

    <?php
    if($submit) {
    $set = SetCookie("pass","$pass", time()+(60*60*24*365),"/","yourdomain");
    header("Location: index.php");
    }
    print<<<END
    <form method=post action="mylogin.php">
    Password: <input type="password" name="pass" value="" size=10 maxlength=10>
    <input type="submit" name="submit" value="Enter">

    </form>
    END
    ?>

    if they enter the wrong password, it will be rejected by the index and sent right back.. if the correct password is set, then grandma can come back for a year and not have to worry about the password.. you could also reset the cookie if they have the right password already and keep on going..

  15. <input type="text" name="username" value="insert_username_here" style="display: none;">

    Well, it'll be similar to that. The important parts are the value="insert_username_here" which makes that username the default value and style="display: none;" which hides the input box. Of course you could put that rule into you CSS file too.

    No need for CSS you know. ;)

    <input type="hidden" name="username" value="insert_username_here">

  16. Ming
    Member
    Posted 9 years ago #

    lol, dang, there ain't no school like old school.

  17. dummy
    Member
    Posted 9 years ago #

    Ming? what? did I post funny? This is the first post I think I ever made on a board that was not my own... If I goofed, then sorry...if not and someone wants to email post to different categories (using the email post setup), I also did that.. a little modification to the mail php..

  18. ceo
    Member
    Posted 9 years ago #

    Ok, my brain sort of fried halfway through this thread, but stupid question - why can't you just password protect EVERY post with the same password. Effectively this would accomplish exactly what you want.

  19. Ming
    Member
    Posted 9 years ago #

    Nah, it was directed towards Viper007Bond's type="hidden". I've been using CSS to solve problems for so long I'm forgetting the basics!

  20. angsuman
    Member
    Posted 8 years ago #

    @ceo
    Because it takes time. Unless someone modifies wordpress to auto-insert same password while posting automatically. The other option is using phpmyadmin.
    But I digress. Personally the simplest solution is the best one IMHO.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.