You can do it in either language. I don't know ASP, so in PHP:
PHP Code:
<?php
$password = "put your password here";
$login_form = <<<END
<!-- Put your login form here, in plain HTML. -->
<html>
<head>
<title>Authorization Required</title>
</head>
<body>
<p>
This page is for members only. If you are a member, please enter your password below. If not, please leave this page.
</p>
<fieldset>
<form action="$PHP_SELF" method="post">
<legend>Password</legend>
<input type="password" name="password"/>
<input type="submit" value="OK"/>
</form>
</fieldset>
</body>
</html>
END;
$login_failed = <<<END
<!-- Put your "authorization failed" page here, in plain HTML. -->
<html>
<head>
<title>Authorization Failed</title>
</head>
<body>
<p>
Your login failed! Please try again by entering your password in the field below.
</p>
<fieldset>
<form action="$PHP_SELF" method="post">
<legend>Password</legend>
<input type="password" name="password"/>
<input type="submit" value="OK"/>
</form>
</fieldset>
</body>
</html>
END;
session_start();
if(!isset($_SESSION['logged_in']) && !isset($_POST['password']))
die($login_form);
if(isset($_POST['password']))
if($_POST['password'] == $password)
$_SESSION['logged_in'] = 1;
else die($login_failed);
?>
Save this to a seperate file (such as security.php), then, at the top of your file(s) (before anything else), put:
Code:
include("security.php");
Untested.
Bookmarks