Into the document calling the private page (pageprive.html for ex.), you must replace the link tag
     <a href="pageprive.html">Wedding of...</a>
by   <a href="pw.php">Wedding of...</a>
The PHP4 script pw.php:
<html>
<title>password with PHP4</title>
<body>
<form action ="" method="POST">
<table>
<tr>
  <td align="right"><font size="+1"><b>Private Page : please give your password</b></font></td>
  <td><input name="pass" type="text" value=""></td>
<td align="center" colspan="2"><input type="submit" value="OK">
</td></tr>
</table>
</form>
<?php
if (isset($_POST['pass'])) {
$pass=$_POST['pass'];
    if ($pass=="password") {
      echo "<HTML><BODY>";
      echo "<br><b>Well done, identification OK.</b>\n";
	  echo "<br><br>";
	  include ("pageprive.html");
      echo "</BODY></HTML>";
      } else {
      echo "<b>Sorry: unknown Password </b>";
    }
}
?>
</body></html>
You must obviously replace password within if ($pass=="password") by your password,
then transmit that password to your authorized visitors,
and keep in mind that "pageprive.html" and "pw.php" are stored in the same directory.

You will find a used example on this site if you click on : Mes Photos


top
© JPSoft - 2004