<?
require_once('db.php');
session_start(); // start session, duh.
?>
<!-- header tags, edit to match your own, or include() template header file. -->
<html>
<head>
<title>Login</title>
<link href="css/index.css" rel="stylesheet" type="text/css">
<head>
<body>
<?
if(!isset($username) | !isset($password)) {
// escape from php mode.
?>
<h1 align="center"><img src="images/chef2.gif" height="130" width="136"></h1>
<h3 class="link">Staff Login</h3>
<form class="form" action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST">
<div id="container">
<input type="hidden" name="_submit_check" value="1"/>
<div style="margin-top:12px; margin-bottom:10px">
<img src="images/username.gif" alt="username" border="0" />
<input class="input" type="text" name="staffID" id="staffID" size="25" maxlength="40" value="" />
</div>
<div style="margin-bottom:6px">
<img src="images/password.gif" alt="password" border="0" />
<input class="input" type="password" name="password" id="password" size="25" maxlength="32" />
</div>
<input type="image" name="Login" value="Login" class="submit-btn" src="images/btn.gif" alt="submit" title="submit" />
</form>
</body>
</html>
<?
exit();
}
// If all is well so far.
session_register("username");
session_register("password"); // register username and password as session variables.
// Here you would check the supplied username and password against your database to see if they exist.
// For example, a MySQL Query, your method may differ, obviously you would make a dataabse connection first.
$sql = mysql_query("SELECT password FROM mariosstaff WHERE username = '$username'");
$fetch_em = mysql_fetch_array('$databases',$sql);
$numrows = mysql_num_rows($sql);
if($numrows != "0" & $password == $fetch_em["password"]) {
$valid_user = 1;
}
else {
$valid_user = 0;
}
// If the username exists and pass is correct, don't pop up the login code again.
// If info can't be found or verified....
if (!($valid_user))
{
session_unset(); // Unset session variables.
session_destroy(); // End Session we created earlier.
// escape from php mode.
?>
<form class="form" action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST">
<p align="center" color="red"><strong>Incorrect login information, please try again.</strong></p>
<div id="container">
<input type="hidden" name="_submit_check" value="1"/>
<div style="margin-top:12px; margin-bottom:10px">
<img src="images/username.gif" alt="username" border="0" />
<input class="input" type="text" name="staffID" id="staffID" size="25" maxlength="40" value="" />
</div>
<div style="margin-bottom:6px">
<img src="images/password.gif" alt="password" border="0" />
<input class="input" type="password" name="password" id="password" size="25" maxlength="32" />
</div>
<input type="image" name="Login" value="Login" class="submit-btn" src="images/btn.gif" alt="submit" title="submit" />
</form>
</body>
</html>
<?
exit();
}