img2.php to HTML

index

USE AT OWN RISK

Generated: Tue Jul 31 15:22:05 2007 from img2.php 2005/11/04 2.6 KB bytes.

<?php

/* A simple PHP login script, using HTTP authentication - 4 November, 2005 - geoffmclane.com
 A simple extension would be to place the username and password in a separate file
 */

if ( isset($_GET[op]) && ($_GET[op] == 'logout')) {
 // the logout area
 header('WWW-Authenticate: Basic realm="Leave form blank, and click \'Ok\' or \'Cancel\' to Log Out"');
 header('HTTP/1.0 401 Unauthorized');
 echo ('<h1 align="center"><b>macpcfirstaid Product Center</b></h1>');
 echo ('<p><b>You have been successfully logged out. Click <a href="img2.php">here</a> to log back in.</b><p>');
 die();

}

if ( !isset($_SERVER[PHP_AUTH_USER]) ) {
 // they did not fill in the form
 header('WWW-Authenticate: Basic realm="Site Login"');
 header('HTTP/1.0 401 Unauthorized');
 echo 'You must enter a valid USERNAME and PASSWORD to access this resource.<br>';
 echo 'Please check your records, and fill in the form appropriately to gain access ...<br>';
 echo 'Click <a href="img2.php">here</a> to try again ...';
 die();

} else {
 $nm = strtolower($_SERVER['PHP_AUTH_USER']);
 $pw = $_SERVER['PHP_AUTH_PW'];
 // try to validate User
 if ( ( $nm == 'beatrice') &&
   ( $pw == 'louis5' ) ) { // Check username and password
 // if validated ... fall through ... and show download available
 echo "Welcome <b>{$_SERVER['PHP_AUTH_USER']}</b>. <a href='img2.php?op=logout'>Logout?</a><br>";
 } else {
 header('WWW-Authenticate: Basic realm="Site Login"');
 header('HTTP/1.0 401 Unauthorized');
 if ($nm == 'beatrice') {
   echo 'You must enter a valid password to access this resource.<br>';
   print "Check your PASSWORD, and try again ...($pw)";
 } else {
   if ($pw == 'louis5') {
   echo 'You must enter a valid username to access this resource.<br>';
   print "Check your USERNAME, and try again ...($nm)";
   } else {
   echo 'You must enter a valid USERNAME and PASSWORD to access this resource.<br>';
   print "Carefully CHECK your records, and try again ... ($nm $pw)";
   }
 }
 die();
 } 

}

?>

<html>
<head>
<title>Product Center - Download Page</title>
</head>
<body bgcolor="#eeeeee">
<h1 align="center">Product Center - Download Page</h1>

<p>Hi Beatrice, you have logged in using HTTP authentication ...</p>

<p>Click on the following link to download the zip file<br>
<b><a href="http://macpcfirstaid.com/zips/img.zip">DWONLOAD</a></b>
</p>

<p>Please note, you will also need your password to extract the image from the zip file.<br>
I hope you like it.<br>
Look forward to hearing from you shortly
</p> 

</body>
</html>

index

Valid HTML 4.01 Transitional