diff options
author | Camil Staps | 2016-07-26 14:27:14 +0200 |
---|---|---|
committer | Camil Staps | 2016-07-26 14:27:14 +0200 |
commit | d8055192991ac8504e48c137038879790c762d2d (patch) | |
tree | 0738603efca98c26d6d04cbd091898d4b6e9a34d /login-ajax.php | |
parent | Option to add first user during installation (diff) |
Adding and deleting users
Diffstat (limited to 'login-ajax.php')
-rw-r--r-- | login-ajax.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/login-ajax.php b/login-ajax.php index f8e1424..beb2f66 100644 --- a/login-ajax.php +++ b/login-ajax.php @@ -30,8 +30,13 @@ require_once('./conf.php'); if (!isset($_SESSION['login']) || $_SESSION['login'] === false) { - print(json_encode(['error' => 'You need to be logged in.'])); + print(json_encode(['success' => false, 'message' => 'You need to be logged in.'])); die(); } $_user = new user($_pdo, $_SESSION['login']); + +if (defined('REQUIRE_ADMIN') && REQUIRE_ADMIN && !$_user->isAdmin()) { + print(json_encode(['success' => false, 'message' => 'You need to be an administrator.'])); + die(); +} |