View Full Version : Simplist Possible Unsecure Password Script (No Database)

06-01-2007, 03:59 PM
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.


06-01-2007, 04:54 PM
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


if($_POST['password'] == 'yourpasswordhere') {
// no php output before this point!
Header('Location: ./path/to/page.php');

Simple not secure login
<h1>Login please</h1>
<form action="?" method="post">
<input type="password" name="password" />
<input type="submit" value="Login" />

06-01-2007, 09:10 PM
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,