Question:

How can I password protect certain areas of my website?

by  |  earlier

0 LIKES UnLike

I need to password protect certain areas of my website. Please can someone give me step by step instructions to do this. My web hosting service doesn't provide a facility to do this unless I pay more a month so I need to write the files myself. I thought I had done it using .htaccess and .htpassword files stored in two different directories (documents and passwords) but I couldn't work out what to link to from my public homepage to make it work. The instructions I used were from here: http://www.htmlgoodies.com/tutorials/getting_started/article.php/3479531

Please help.

 Tags:

   Report

3 ANSWERS


  1. put this  on your .htaccess file

    ---------------

    deny from all

    AuthName "HTML Goodies Login"

    AuthType Basic

    AuthUserFile /<pathtoyour>/passwordfile

    require valid-user

    --------------

    Your password file should have this format

    --------------

    username:password

    ---------------

    if your using command line you can use htpasswd to generate the password file

    Is the command

    htpasswd -c passwordfile username

    Then put the .htpasswd file into the directory you wnat to protect

    I'm not familiar with .htpasswd as this is what i do on our server farm or I do it on apache httpd.conf

    hope this help

    More computer tips at

    http://www.review-ninja.com


  2. Make a PHP script, HTML form to supply the password, then the HTML form sends it using $_POST to the PHP script that querys your database for the two passwords, if the password suppled matches the password in the database then it redirects to the password protected page.

  3. You need HTML/JAVA SCRIPT codes

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.