<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>
Single-Page Password Protection
Leave a Reply
You must be logged in to post a comment.