require_once "NRG/Configuration.php"; require_once '../database.php'; //Require data entry privileges setClearanceLevel(30); //Check for errors if (empty($_POST) || empty($_POST['subjectid'])) { ajax_error('Invalid request.'); } $subjectid = trim($_POST['subjectid']); if (empty($subjectid)) { ajax_error('Invalid Subject ID.'); } if (!preg_match('/^[A-Za-z0-9]+$/', $subjectid)) { ajax_error('The Subject ID you have entered contains invalid characters.'); } //Connect to the database try { $config = new \NRG\Configuration(CONFIG_FILE); $dbconf = $config->Database; $db = new Database($dbconf['host'], $dbconf['user'], $dbconf['pass'], $dbconf['name'], $dbconf['port']); //Verify the subject isn't locked if ($db->isSubjectLocked($subjectid)) { ajax_error('Sorry, this subject has been locked. No data entry is allowed for locked subjects.'); } $session = $db->createSession($subjectid, $_SESSION['aclID']); $result = array("success" => 1, "session" => $session['label']); ajax_result($result); } catch (Exception $e) { error_log($e->getMessage(), 0); ajax_error('An internal server error has occured. Please try again later.' . $e->getMessage()); }
ini_set('display_errors', 1); error_reporting(E_ALL); if (!isset($_SESSION)) { session_start(); } require_once 'scripts/database.php'; $db = new Database(); $db->connectToDB(); if ($db->checkLoginStatus() == true) { header('Location: repairs.php'); } if ($_POST) { $username = $_POST['username']; $password = $_POST['password']; $db->createSession($username, $password); } ?> <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login for Celtel Employee</title> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> <script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script> <script type="text/javascript" src="js/validation.min.js"></script> <link href="css/style.css" rel="stylesheet" type="text/css" media="screen"> <script type="text/javascript" src="js/script.js"></script> </head>