Include("Includes/global.inc.php");
forceSSL();
If ($HTTP_POST_VARS["btnSubmit"]!="") {
$strPassword = validateText("Password", $txtPassword, 6, 10, TRUE, FALSE);
$strUserName = validateText("User ID", $txtUserName, 3, 20, TRUE, FALSE);
If ($strError == "") {
$strPassword = md5($strPassword);
$strSQL = "SELECT id, securityLevel FROM tblSecurity WHERE userID='$strUserName' AND password='$strPassword'";
$result = dbquery($strSQL);
$row = mysql_fetch_row($result);
If ($row[0] != "") {
session_start();
$userID = $row[0];
$sessionTime = time();
$sessionSecurity = $row[1];
$strSQL2 = "Update tblSecurity Set lastLogin=".date("YmdHis")." Where id = ".$row[0];
$result2 = dbquery($strSQL2);
If (!$strError) {
header ("Location: $strRedir");
exit;
}
} Else {
$strError = "Either that username or password was incorrect.";
}
}
}
writeHeader("");
switch ($strError) {
case "timeout":
$strError = "Your session has timed out. Please log in again.";
break;
case "security":
$strError = "Sorry, you do not have rights to that page.";
$intNote = 1;
break;
case "login":
$strError = "Please log in.";
break;
case "":
$strError = "";
break;
}
If ($strError != "") {
echo "$strError
";
}
?>