Encrypting a page?

Discussion in 'HTML & Website Design' started by cj1223, Sep 7, 2006.

  1. #1
    im makeing a lttle online office space and i made the page from scratch but i want to enkrypt the entire page with a pass so when ever the adress is hit in browser you have to type a pass. i dont know how to do this?
     
    cj1223, Sep 7, 2006 IP
  2. Dabs

    Dabs Peon

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    search around for ".htaccess"
     
    Dabs, Sep 8, 2006 IP
  3. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There are several ways password proted your page, however this is one of the easier:

    
    <?php
    
    $myusername = "myusername";
    $mypassword = "mypassword";
    $areaname = "Authorization Required";
    
    if ($_SERVER["PHP_AUTH_USER"] == "" || $_SERVER["PHP_AUTH_PW"] == "" || $_SERVER["PHP_AUTH_USER"] != $myusername || $_SERVER["PHP_AUTH_PW"] != $mypassword) {
        header("HTTP/1.0 401 Unauthorized"); 
        header("WWW-Authenticate: Basic realm=\"$areaname\""); 
        echo "<h1>Authorization Required.</h1>"; 
        die();
    }
    
    ?>
    
    Code (markup):
    However if you need additional encryption, have a look at this post:
    http://forums.digitalpoint.com/showthread.php?t=137579
    Code (markup):
     
    Pat Gael, Sep 8, 2006 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    kk5st, Sep 8, 2006 IP