Пример #1
0
<?php

require_once "MiscFunction.php";
require_once "admin.php";
require_once "connection.php";
require_once "dao.php";
$con = new Connection();
$connection = $con->getConnection();
$misc = new MiscFunction($connection);
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
        echo "Admin " . $fullname . " created <br/><br/>";
        echo "<a href='createAdmin.php'> Create new Admin </a>";
    }
}
Пример #2
0
<?php

if (isset($_POST["submit"])) {
    require_once "../models/connection.php";
    require_once "../controllers/miscfunction.php";
    require_once "../controllers/notifications.php";
    $username = $_POST["username"];
    $password = $_POST["password"];
    $con = new Connection();
    $connection = $con->getConnection();
    $misc = new MiscFunction($connection);
    $notifyObject = new Notifications();
    $loginValues = array("username" => $username, "password" => $password);
    $_SESSION["loginValues"] = $loginValues;
    $validateLogin = $misc->validateLogin($username, $password);
    if ($validateLogin === false) {
        header("location:./views/login.php");
    }
    $result = $misc->getAdminDetails($username, $password);
    if (mysqli_num_rows($result) == 1) {
        while ($row = $result->fetch_assoc()) {
            $status = $row["status"];
            if ($status == 0) {
                $msg = "You are not allowed to access this page because you have been deacvtivated!!!";
                echo $notifyObject->errorMessage($msg);
                exit;
            }
            $_SESSION["name"] = $row["name"];
            $_SESSION["level"] = $row["level"];
            $level = $row["level"];
            $_SESSION["Admin_Id"] = $row["admin_id"];
Пример #3
0
require_once "connection.php";
require_once "miscFunction.php";
require_once "notifications.php";
require_once "dao.php";
//check if QA admin is logged in
if (!isset($_SESSION["Admin_Id"])) {
    header("location:login.php");
}
if ($_SESSION["level"] != 1) {
    header("location:login.php");
}
if (isset($_GET["Admin_Id"])) {
    $Admin_Id = $_GET["Admin_Id"];
    $con = new Connection();
    $connection = $con->getConnection();
    $misc = new MiscFunction($connection);
    $notifyObject = new Notifications();
    $dao = new Dao($connection);
    $finishSession = $dao->finishSession($Admin_Id);
    unset($_SESSION["state_name"]);
    $adminName = $misc->getAdminName($Admin_Id);
    $msg = "<h3>Thank You " . $adminName . " !!!</h3>";
    echo $notifyObject->successMessage($msg);
    ?>
	
	
	
	
	<meta http-equiv="refresh" content="2;url=login.php" />
	
	<?php