Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Simplist Possible Unsecure Password Script (No Database)

    Hi everyone,

    Could you please tell me what the simplist password script is? I don't need a database and it doesn't need to be secure. All I need someone to do is enter a password and be redirected to a new page if the password is correct.

    I would really appreciate it.

    Brandon

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Brandon,

    Try this. I didn't test it, but I think it should work. The form submits to the same page. If the posted password equals the value you specified it will redirect to "./path/to/page.php". Note that the 'secret page' itself is not protected and will appear in the browser cache once it has been accessed.

    There are other, simple but more secure ways to do it (e.g. adding a password check on the protected page). But this fits your description best.

    Cheers. Michiel

    Code:
    <?php
    
    if($_POST['password'] == 'yourpasswordhere') {
      // no php output before this point!
      Header('Location: ./path/to/page.php');
    }
    
    ?>
    <html>
     <head>
      <title>
       Simple not secure login
      </title>
     </head>
     <body>
      <h1>Login please</h1>
       <form action="?" method="post">
        <label>Password</label>
        <input type="password" name="password" />
        <input type="submit" value="Login" />
      </form>
     </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot Michiel.

    I'll test it out in a little while. I realize there are more secure ways to do it, but I don't need anything secure. Just extremely simple like the one you posted.

    Thanks again,
    Brandon


  •  

    Posting Permissions

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