function delete_user($user_id)
{
    if (!check_app_admin()) {
        $_SESSION['notifications'][] = "You are not an administrator!";
    } else {
        if ($user_id == $_SESSION['user_id']) {
            $_SESSION['notifications'][] = "You cannot deactivate yourself!";
        } else {
            if (check_app_admin($user_id)) {
                unmake_admin($user_id);
            }
            if (check_supervisor($user_id)) {
                unmake_super($user_id);
            }
            $sql = "UPDATE users SET inactive=1 WHERE user_id=" . $user_id;
            $_SESSION['dbconn']->query($sql) or die("Error deactivating user: "******"Successfully removed user!";
        }
    }
}
Example #2
0
}
//If a user was made admin
if (isset($_POST['makeadmin-submit'])) {
    make_admin($_POST['makeadmin-id']);
}
//If a user was unmade admin
if (isset($_POST['unmakeadmin-submit'])) {
    unmake_admin($_POST['unmakeadmin-id']);
}
//If a user was made super
if (isset($_POST['makesuper-submit'])) {
    make_super($_POST['makesuper-id']);
}
//If a user was unmade super
if (isset($_POST['unmakesuper-submit'])) {
    unmake_super($_POST['unmakesuper-id']);
}
//If a user had his password reset
if (isset($_POST['pwreset-submit'])) {
    $newpass = reset_password($_POST['pwreset-id']);
    draw_newpass_success($newpass);
}
if (isset($_POST['edituser-submit'])) {
    edit_user($_POST);
}
if (isset($_GET['user_id'])) {
    $userinfo = get_user_info($_GET['user_id']);
}
if (count($_SESSION['notifications']) != 0) {
    draw_notification();
}