<?php session_start(); require_once "../models/connection.php"; require_once "../models/dao.php"; require_once "../controllers/notifications.php"; $con = new Connection(); $connection = $con->getConnection(); $DAOobject = new Dao($connection); $notifyObject = new notifications(); if (isset($_POST["startSession"])) { $state = $_POST["state"]; $DAOobject->configureNewSession($state); $_SESSION["state"] = $state; header("location: configure.php"); return; } elseif (isset($_POST["endSession"])) { $statename = ""; if (isset($_SESSION["state"])) { $statename = $_SESSION["state"]; } $DAOobject->EndSession($statename); unset($_SESSION["state"]); $msg = "The current session for '{$statename} 'has ended!!!"; echo $notifyObject->successMessage($msg); } ?> <html> <br/> <a href="../views/adminindex.php"><button class="btn btn-primary"> HOME </button></a> </html>
if (!isset($_SESSION["Admin_Id"])) { header("location:../views/login.php"); } if ($_SESSION["level"] != 2) { header("location:../views/login.php"); } $con = new Connection(); $connection = $con->getConnection(); $misc = new MiscFunction($connection); $notifyObject = new notifications(); if (isset($_POST["submit"])) { $fullname = $_POST["fullname"]; $username = "******" . $misc->createPassword(); //creates new admin username $password = $misc->createPassword(); //creates nes admin password //validate user input $errMsg = $misc->validateInput($fullname); if ($errMsg !== "") { $_SESSION["error"] = $errMsg; header("location: createAdmin.php"); } else { $adminObj = new Admin($fullname, $username, $password); $DAOobject = new Dao($connection); $DAOobject->createNewAdmin($adminObj); //create new QA admin $msg = "Admin " . $fullname . " has been created <br/><br/>"; echo $notifyObject->successMessage($msg) . '<br/><br/>'; echo "<a href='../views/createAdmin.php'> Create new Admin </a>"; } }