Example #1
0
        $question = display_report_panel($_GET["id"]);
        display_question_panel($question, $_GET["id"]);
    } else {
        echo '<center><div class="alert alert-danger panel_login">Wrong username or password!</div></center>';
        Utils::display_login();
    }
} else {
    if ($_GET["action"] == "logout") {
        Utils::logout();
        echo '<center><div class="alert alert-info panel_login">You have been successfully logged out.</div></center>';
        Utils::display_login();
    } else {
        if ($_POST["idQuestion"] && $_POST["txtQuestion"] && $_POST["txtAnswer"] && $_POST["selTheme"] && $_POST["idState"] && $_GET["id"]) {
            Utils::display_admin_navbar("Report Manager");
            echo '<div class="container">';
            if ($db->update_state($_GET["id"], $_POST["selState"])) {
                if ($trivia->update_question($_POST["idQuestion"], $_POST["txtQuestion"], $_POST["txtAnswer"], $_POST["selTheme"])) {
                    echo '<div class="alert alert-success col-sm-8 col-sm-offset-2">Report and question were successfully saved.</div>';
                } else {
                    echo '<div class="alert alert-danger col-sm-8 col-sm-offset-2">Error while trying to save question.</div>';
                }
            } else {
                echo '<div class="alert alert-danger col-sm-8 col-sm-offset-2">Error while trying to update report state. Please go easy on the developer.</div>';
            }
            echo '</div>';
            $question = display_report_panel($_GET["id"]);
            display_question_panel($question, $_GET["id"]);
        } else {
            if ($_POST["selState"] && $_GET["id"]) {
                Utils::display_admin_navbar("Report Manager");
                echo '<div class="container">';