security.inc.php. Include at the very top of your page(s) with:
Code:
<?php require("security.inc.php"); ?>
Code:
<?php session_start();
$password = "your password goes here";
function showLoginForm($badpw = false) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Login Form</title>
</head>
<body>
<form action="<?php echo($PHP_SELF); ?>" method="post">
<p>
<?php if($badpw) { ?>
The password you entered was incorrect. Please try again.
<?php } ?>
<input type="password" name="pass">
<input type="submit" value="Log In">
</p>
</form>
</body>
</html>
<?php
return "";
}
if(!isset($_SESSION['pwhash']) && !isset($_POST['pass']))
die(showLoginForm());
else if(isset($_POST['pass']))
if($_POST['pass'] == $password) $_SESSION['pwhash'] = md5($password);
else die(showLoginForm(true));
else if(isset($_SESSION['pwhash']))
if($_SESSION['pwhash'] != md5($password)) die(showLoginForm(true));
?>
Bookmarks