<?php require_once('Connections/incidentlog.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_incidentlog, $incidentlog);
$query_status = "SELECT `section`, status FROM service ORDER BY id ASC";
$status = mysql_query($query_status, $incidentlog) or die(mysql_error());
$row_status = mysql_fetch_assoc($status);
$totalRows_status = mysql_num_rows($status);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "logs_home.php";
$MM_redirectLoginFailed = "login.php?fail";
$MM_redirecttoReferrer = false;
mysql_select_db($database_incidentlog, $incidentlog);
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $incidentlog) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Incident Logs - Home</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include("inc/header.php");
?>
<?php
include("inc/menu.html");
?>
<table width="100%" border="0" cellpadding="8" cellspacing="0">
<tr>
<td width="220" valign="top">
<h2><?php echo "$Log_In" ?></h2>
<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name="login">
<p><?php echo "$User" ?>:<input name="user" type="text" /></p>
<p><?php echo "$Pass" ?>: <input name="pass" type="password" /></p>
<input name="Log In" type="submit" value="Log In" />
</form>
<br />
<input name="fogpass" type="button" id="fogpass" value="Forgotten Password" />
</p>
</td>
<td width="175" valign="top">
<h2><?php echo "$Service" ?></h2>
<p>All scripts and databases are running normally.</p>
<!-- <table width="100%" cellspacing="0" cellpadding="2">
<tr>
<th scope="col"><p>Section</p></th>
<th scope="col"><p>Running</p></th>
</tr>
<?php do { ?>
<tr>
<td scope="col"><p><?php echo $row_status['section']; ?></p></td>
<td align="center" class="<?php echo $row_status['status']; ?>" scope="col"><p><?php echo $row_status['status']; ?></p></td>
</tr>
<?php } while ($row_status = mysql_fetch_assoc($status)); ?>
</table>
<p class="key">
OT - On Time<br />
L - Late<br />
S - Suspended<br />
</p> -->
</td>
<td valign="top">
<h2><?php echo "$CIL" ?></h2>
<?php include ("inc/intro.html") ?></td>
</tr>
</table>
<br />
<?php
include("inc/footer.php");
?>
</body>
</html>
<?php
mysql_free_result($status);
?>