I found the following script which works does the job, except now I have been asked if it is possible to set up things so that within a browser session, the password is "remembered" so that people won't have to re-enter the password if the browse away from the protected page and then go back again.
This is a little out of my league as I am new to php so I was hoping someone here could help me add the required code.
Here is what I have so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Members Page</title>
<?php $password = "admin";?>
</head>
<body>
<div id="top">
<div id="header"></div>
</div>
<div id="menu">
<ul>
<li><a href="#nogo">Home</a></li>
<li><a href="#nogo">Sunday Services</a></li>
<li><a href="#nogo">Activities</a></li>
<li><a href="#nogo">Gallery</a></li>
<li><a href="#nogo">Community</a></li>
<li><a href="#nogo">Youth</a></li>
<li><a href="#nogo">Letting / Room hire</a></li>
<li><a href="#nogo">Contact</a></li>
</ul>
</div>
<div id="content">
<div id="content-wrapper">
<div id="left">
<div class="inner-wrapper">
<h2>Members Page</h2>
<?php
if (isset($_POST["password"]) && ($_POST["password"]=="$password")) {
?>
<!-- START OF HIDDEN CONTENT -->
<p>Congratulations you have gained access to the Protected and Secret Area!</p>
<!-- END -->
<?php
}
else
{
if (isset($_POST['password']) || $password == "") {
print "<h4>Incorrect Password</h4><h4>Please enter the correct password</h4>";}
print "<form method=\"post\" action=\"\"><p>Please enter your password for access<br />";
print "<input name=\"password\" type=\"password\" size=\"25\" maxlength=\"10\" /><input value=\"Login\" type=\"submit\" /></p></form>";
}
?>
</div>
</div>
<div id="right">
<div class="inner-wrapper"></div>
</div>
<div id="content-footer"></div>
</div>
</div>
<div id="footer"></div>
</body>
</html>Here is a link to the demo page as it is working now. LINK
Thanks
Cara

Help








MultiQuote














