Results 1 to 5 of 5

Thread: How can I make Password protection on page ?

  1. #1
    Join Date
    Nov 2006
    Posts
    7

    Default How can I make Password protection on page ?

    hello all

    I'm newbie to phpbb script. But I have been using HTML script for over 2 years. I know HTML can't put password protection on the page for everyone even using .htmlaccess . But I'm quite sure phpbb script can handle password protected page. However as I mentioned as I'm a newbie to phpbb script..I have no clue about how to add code in page to use password protected page. If you guys know a lot and have knowledge about codes, please explain to me and I will try my best to work on the script. Thank you guys.

    Nick

  2. #2
    Join Date
    Nov 2006
    Location
    Brighton / England
    Posts
    118

    Default

    well im not good with html , but i like webpages that give you a code generator. So all you do is type in your desired password and Url or something and it generates it for you:

    http://www.htmlbasix.com/passwordprotect.shtml

  3. #3

    Default

    Normally you password protect your web directory. But then for that you need hosting that allows that.
    I once used a utility called HTML Lock or something like that. It encrypts the page and sets a password to it.
    Try Google!! :)

  4. #4
    Join Date
    Apr 2007
    Posts
    7

    Default

    Unless you have a database, its not easily password protected without just looking at the script for the password.

  5. #5
    Join Date
    Mar 2007
    Posts
    52

    Default

    This is a rudimentary Password approach. Three seperate scripts.
    You must have PHP.


    ******This PHP script is run at a local server to generate a Hash. This should not be on the Prod site.


    <?php
    $pwd = "MyPassword"; // this page generates the hash code for the password
    $hash = md5($pwd);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Password Generator</title>
    </head>
    <body>
    <?php echo $hash ?>
    </body>
    </html>

    ***** This page is a logon screen where the user would enter the Password used above


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>

    <form action="AnterPDFIndex.php" method="post" name="PWDform" target="_self">
    <input name="userPWD" type="text" />
    <input name="goBtn" type="submit" value="View PDF" />

    </form>
    </body>
    </html>

    ******* This is the form processing script. User must enter correct password to get Hashes to match

    <?php
    session_start(); // must be written prior to sending any page headers to browser
    $pwd = $_POST['userPWD'];
    $hash = md5($pwd);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Successful Logon page</title>
    </head>
    <body>
    <?php
    if ($hash != "48503dfd58720bd5ff35c102065a52d7") { // This is the hash generated by genPwd.php
    ?>

    Sorry you are not authorized to view this page.

    Password Incorrect.
    <?php return;
    }
    ?>

    Logon successful Add further HTML here.

    </body>
    </html>
    [/code]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •