<?php $password = "abc123"; if ($_POST[doddle] == $password) { $tell = 1; } else { $tell = 2; } if (! is_string($_POST[doddle])) $tell = 0; ?> <html> <head><title>A Page that is password protected</title></head> <body> <?php if ($tell == 1) { ?> <h1>The page with all the secrets revealed </h1> This is the information that has been revealed to you because you got the password right!<br /><br />Although this is a very simple demo it shows what you can do with just a few lines of PHP. <?php } else { ?> <h1>A Header page</h1> There is a page hidden under a password at this URL. For this demo only I will tell you that the password is "abc123" so you can try it out!<br /> <?php if ($tell == 2) print ("<br />YOU GOT THE PASSWORD WRONG<br />"); ?> <br /> <form method=post> Please enter password <input type=password name=doddle> <input type=submit value=go> </form> <?php } ?> <hr /> <a href=http://www.wellho.net>Well House Consultants</a>, 2007 </body> </html>
You need to create an account or log in to post comments to this site.