Example #1
0
    exit;
}
if (isset($_SESSION["last_activity"]) && $_SESSION["last_activity"] + $_SESSION["time_out"] * 60 < time()) {
    session_unset();
    session_destroy();
    ?>
    <script>
        window.parent.location.href = window.parent.location.href;
    </script>
<?php 
    exit;
}
$_SESSION["last_activity"] = time();
if (isset($_POST["new_username"])) {
    try {
        if (!UserTable::add_new_user($_POST['new_username'], $_POST["new_firstname"], $_POST["new_lastname"], $_POST['new_password'], $_POST['userrole'])) {
            echo '<div class="error">Username already exists</div>';
        }
    } catch (Exception $e) {
        echo '<div class="error">' . $e->getMessage() . '</div>';
    }
}
if (isset($_POST["delete_username"])) {
    UserTable::delete_user($_POST["delete_username"]);
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">