www.webdeveloper.com
Results 1 to 5 of 5

Thread: Creating Accounts

  1. #1
    Join Date
    May 2006
    Posts
    3

    Creating Accounts

    Ok so here is my problem. I am a student webpage designer (Highschool) and am looking for how to make a 'members only' section of my page. Does anyone know how to make an passworded account? I am soooo confused.

  2. #2
    Join Date
    May 2003
    Location
    Milwaukee
    Posts
    342
    If it's an Apache server...

    Google .htaccess

  3. #3
    Join Date
    May 2006
    Posts
    3
    yea sorry it isn't

  4. #4
    Join Date
    Oct 2005
    Location
    Manchester UK
    Posts
    16
    You can also use PHP for password protected pages.

    PHP Code:
    <?php

    $form 
    "<table>
    <tr>
    <td align='center' bgcolor='lightblue'>
    <font face='verdana' size='1'><b>This page is password protected!</b></td></tr>
    <tr>
    <td align='center'><form method='post' action='protected.php'>
    <input name='password' type='password' id='password' maxlength='15'></td></tr>
    <tr><td align='center'>
    <input type='submit' name='Submit' value='Unlock this page!'></form></td></tr>
    </table></center>"
    ;

    echo 
    "$form";
    ?>
    PHP Code:
    <?PHP
    $setpassword 
    "PASSWORD";
    // Change the password above
    $password $_POST['password'];

    if (
    $password == $setpassword)
    {
    echo 
    "Access granted.";
    }
    else
    {
    echo 
    "Access denied.";
    }
    ?>
    Also another different way is:

    PHP Code:
    <?
    //part 1
    if (!isset($PHP_AUTH_USER))
    {
        
    header("WWW-Authenticate: Basic realm=\"Your Password.\"");
        
    Header("HTTP/1.0 401 Unauthorized");
        exit;
    }     

    //part 2
    else if(($PHP_AUTH_USER=="youruser") && ($PHP_AUTH_PW=="yourpassword"))
    {
       echo 
    "Authenticated!";
       
    //place the code for the whole user page in here
       //you can also set up a redirect to the user page if you want
    }

    //part 3
    else  
    {
       echo 
    "Login Failed";
       
    //fail try again
    }
    ?>
    Last edited by Raremandan; 05-23-2006 at 08:42 PM.
    Dan Williamson - Web Portfolio

    Skillset: - (x)HTML, CSS, Web Standards, SEO

  5. #5
    Join Date
    May 2006
    Posts
    3

    Red face

    Heh I guess I should be named super noob but how would I go about encrypting them to begin w/
    Last edited by Emry; 05-25-2006 at 12:38 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles