<?
ob_start();


echo <<< BEGIN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE>
	Student Grades
  </TITLE>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
  <META HTTP-EQUIV="Expires" CONTENT="-1">
 </HEAD>
 <BODY OnLoad="document.MyForm.Name.focus(); document.MyForm.reset();">
 <H1 ALIGN="center">Student Grades</H1>
BEGIN;

// Process data submitted by the form.
if (isset($_POST['submitted']))
{
 $username = trim($_POST['username']);
 $password = trim($_POST['password']);
 
 $errors = array();
 if (empty($username)) // username should not be empty
	$errors[] = "Your username.";
 if (empty($password)) // Password should not be empty
	$errors[] = "Your password.";
 if (empty($errors))
 {
	
	// Check if the username exists and the password matches

	if // If there is something wrong
	{
	}
	else // If the user exists and the password matches.
	{
		
	}	
 }
 else // If username or password is left empty
 {
	echo "<h2 align=\"center\">Missing Information</h2><center>\n";
	echo "Click the 'back' button in the browser, and fill out:<br> \n";
	echo "<FONT COLOR='red'>";
	foreach ($errors as $error)
		echo "$error<br>\n";
	echo "</FONT></center>\n";
 } 
} // if submitted
else // Display form
{
	echo <<< BEGIN
	<CENTER>
	<h3>Enter the username and the password</h3>
	<TABLE WIDTH="60%">
	 <TR>
	  <TD>
	   <FORM name="MyForm" ACTION="{$_SERVER['PHP_SELF']}" METHOD="POST">
		<B>*Username:</B> <INPUT NAME="username" SIZE="15" TYPE="text">
		<B>*Password:</B> <INPUT NAME="password" SIZE="15" TYPE="password">
		<INPUT NAME="submitted" TYPE="hidden" VALUE="TRUE">
		<p></p>
		<CENTER>
		 <INPUT TYPE="Submit" VALUE="SUBMIT"> 
		 <INPUT TYPE="reset" VALUE="CLEAR">
		</CENTER>
	  </FORM>
	  <center><I>The fields marked with * must be filled out.</I></center>
	</td>
      </tr>
     </table>
BEGIN;
}
ob_end_flush();
?>

 </center>
 </body>
</html>

