<?php
$loginfile = 1;
require_once('Connections/t77_connect.php');
// *** Validate request to log in to this site.
session_start();
$loginFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($HTTP_POST_VARS['username'])) {
$loginUsername=$HTTP_POST_VARS['username'];
$password=md5($HTTP_POST_VARS['password']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "fail.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_t77_connect, $t77_connect);
$LoginRS__query=sprintf("SELECT username, userpass FROM t77_bill_settings WHERE username='%s' AND userpass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $t77_connect) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($HTTP_SESSION_VARS['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $HTTP_SESSION_VARS['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"><img src="images/tabletopstart.gif" width="20" height="31" /></td>
<td><table width="100%" height="30" border="0" cellpadding="5" cellspacing="0">
<tr>
<td><p><strong>Login</strong></p>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="20">
<tr>
<td align="center" valign="top"><form name="loginform" id="loginform" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="250" border="0" cellpadding="0" cellspacing="0" class="tableBorder">
<tr>
<td class="tableTop"><table width="250" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><h1>Login</h1></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="250" border="0" cellspacing="0" cellpadding="10">
<tr>
<td><table width="250" border="0" cellpadding="5" cellspacing="0">
<tr>
<td align="right" valign="baseline"><h1>Username:</h1>
</td>
<td><input name="username" type="text" id="username" size="24" />
</td>
</tr>
<tr>
<td align="right" valign="baseline"><h1>password:</h1>
</td>
<td><input name="password" type="password" id="password" size="24" />
</td>
</tr>
<tr>
<td align="right" valign="baseline"> </td>
<td><input type="submit" name="Submit" value="Login" />
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>