login04.php to HTML

index

USE AT OWN RISK

Generated: Tue Jul 31 15:22:08 2007 from login04.php 2006/03/15 3 KB bytes.

<?php
// if login set, get info from POST ...
if( isset($_GET['login']) ) { 
   // establish user names and passwords
   $user2 = 'user2'; 
   $pass2 = 'pass2'; 
   $user3 = 'user3'; 
   $pass3 = 'pass3'; 
   // get user input from POST
   $form_user = $_POST['username']; 
   $form_pass = $_POST['password']; 
   // check if the entry matches ...
   if( (($user2 == $form_user) && ($pass2 == $form_pass)) || 
   (($user3 == $form_user) && ($pass3 == $form_pass)) ) { 
   // SUCCESS - fall in to SHOW the desired content, hidden by LOGIN
?>

<!-- the following section can be REPLACED with any normal web page -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
<title>Download File Listing</title>
</head>
<body>
<h1 align="center">Download File List</h1>
<ul>
<li><a href="image001.png">File 1</a>
<li><a href="image003.png">File 2</a>
<li><a href="image005.png">File 3</a>
</ul>
<!-- the name following the 'href' MUST be the name of this file -->
<p><a href="login04.php">Logout</a> or just <b>CLOSE</b> the browser ...</p>
<!-- another way to allow download is to show the files -->
<table><tr>
<td><img src="image001.png"></td>
</tr><tr>
<td><img src="image003.png"></td>
</tr><tr>
<td><img src="image005.png"></td>
</tr>
</table>
</body>
</html>
<!-- end of the 'normal' web page -->

<?php 
   } else { 
   // show FAILED
   print "<h1 align=\"center\">Download Login Failed</h1>\r\n";
   print "<p align=\"center\">Sorry, Username or Password Failed!<br>\r\n"; 
   print "Click <a href='login04.php'>BACK</a> to try again ...</p>\r\n"; 
   } 
} else { 
   // show the LOGIN FORM
?>
 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<title>Download File Login</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
</head> 
<body> 
<h1 align="center">Download File Login</h1>

<p>To download the files, enter the username and password in the following form, 
then click 'Validate' ... if it is correct you should then see the download 
page ...</p>

<!-- note: the name following the word 'action' MUST be the same name as this file,
 and it MSUT be followed by '?login=1' -->
<p align="center">
<center>
<form action="login04.php?login=1" name="login" method="post"> 
Username: <input name="username" type="text" title="UserName"><br> 
Password: <input name="password" type="password" title="Password"><br> 
<input name="Go" type="submit" value="Validate"> 
</form>
</center>
</p>

<p>Since you are now not logged in, to <b>logout</b>, just <b>CLOSE</b> the browser ...</p>

<p><font color="gray">psst, try 'user2' with 'pass2', or 'user3' with 'pass3' ... of course, 
this line MUST be REMOVED ;=)) other users can be set at the top of the file ... 
these are NOT visible to users ...</font></p>

</body> 
<!-- simple login, using two users,
 with respective passwords ... 20060315 ... geoff -->
</html> 

<?php 
} 
?>

index

Valid HTML 4.01 Transitional