Return to Snippet

Revision: 4336
at November 28, 2007 16:38 by hced


Initial Code
<html>
<head>
<title>Private Page</title>
</head>
<body>

<?php
$password = "phpmac";

if (!isset($_POST['submit'])) {
?>
<form action="" method="POST">
Enter the Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<?php
} else {

if ($_POST['password'] == $password) {

?>

Secret content!

<?php
} else {
?>

<form action="" method="POST">
Enter the Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>

<?php
}
}
?>

</body>
</html>

Initial URL
http://www.phpmac.com/articles.php?view=242

Initial Description
Makes a password protection system for single webpages.

Initial Title
Single-Page Password Protection

Initial Tags


Initial Language
PHP