<html>
<! BasicLoginRealm.php                                        >
<! Chapter 11, Oracle Database XE PHP Web Programming         >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script demonstrates a basic HTTP authentication.      >
<head>
<title>
  Chapter 11 : BasicLoginRealm.php
</title>
<style type="text/css">
  div#centered {border:0;height:50%;top:25%;left:25%;width:50%;
                position:absolute;}
</style>
</head>
<body>
<?php
  // Verify the credentials for the realm or force authentication.
  if ((@$_SERVER['PHP_AUTH_USER'] != 'username') ||
      (@$_SERVER['PHP_AUTH_PW'] != 'password'))
  {
    header('WWW-Authenticate: Basic Realm="it.techtinker.com"');
	header('HTTP/1.0 401 Unauthorized');
    print 'Please enter a valid user and password.';
    exit;
  }
  else
  {
    // Render the username and password sent.
    print '<div id=centered>';
    print '<table border="1" bordercolor="silver" cellspacing="0">';
    print '<tr>';
    print '<td><b>Variable Name</b>&nbsp;</td>';
    print '<td align="center" width="100"><b>Clear Text</b></td>';
    print '</tr>';
    print '<tr>';
    print '<td align="right" width="150"><b>PHP_AUTH_USER</b></td>';
    print '<td align="center">';
	print $_SERVER['PHP_AUTH_USER'];
    print '</td>';
    print '</tr>';
    print '<tr align="center">';
    print '<td align="right" width="150"><b>PHP_AUTH_PW</b></td>';
    print '<td>';
	print $_SERVER['PHP_AUTH_PW'];
    print '</td>';
    print '</tr>';
    print '</table>';
    print '</div>';
  }
?>
</body>
</html>