requireAdmin(); $users = User::getAll(); if (isset($_REQUEST["action"])) { $action = $_REQUEST["action"]; $user_id = (int)$_REQUEST["id"]; $user = User::get($user_id); if ($user && !$user->isAdmin()) { switch ($action) { case "grant": $user->is_allowed = 1; $user->update(); break; case "revoke": $user->is_allowed = 0; $user->update(); break; case "remove": $user->delete(); break; } } http::redirect("/users.php"); } Layout::header(); ?>

User Accounts

ID Name Email Access Actions
user_id ?> name); ?> email); ?> isAdmin() ? "Admin" : ($users[$i]->isAllowed() ? "Granted" : "No"); ?> isAdmin()) { $action = $users[$i]->isAllowed() ? "revoke" : "grant"; $url = URL_ROOT . "/users.php?action=$action&id=" . (int)$users[$i]->user_id; $delete = URL_ROOT . "/users.php?action=remove&id=" . (int)$users[$i]->user_id; print "{$action} access,  "; print "delete account"; } ?>