...

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



rushindo
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.

Brandon

Michiel
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



<?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>

rushindo
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,
Brandon



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum