Website Summary Files Commits Branches @commit @diff @stats
path: root / views / admin / index.php
diff options
context:
space:
mode:
Commite0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-02-02 15:52:58 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-02-02 15:52:58 +0200
Filese0562c4683f27c7700ceb16e6faa3a06dd3f50f8 /views/admin/index.php
nowayforward_human-e0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31.tar
nowayforward_human-e0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31.tar.gz
nowayforward_human-e0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31.zip
Parent179ebaebc36b6dc470dacad5a9020e4d6bf9921a (diff)
feat: Implement admin panel with the ability to change role of users
1 files changed, 34 insertions, 0 deletions
-rw-r--r--views/admin/index.php34
diff --git a/views/admin/index.php b/views/admin/index.php
new file mode 100644
index 0000000..69495d6
--- /dev/null
+++ b/views/admin/index.php
@@ -0,0 +1,34 @@
+<?php
+ $user = require_login();
+?>
+
+<?php if ($user->Role === 'Admin'): ?>
+ <h2>Change role</h2>
+
+ <form action="#" method="POST" class="font-115">
+ <input type="hidden" name="method" value="PATCH">
+ <?php if (isset($role_status)): ?>
+ <?php if ($role_status !== ""): ?>
+ <p class="item error"><span>
+ <strong>Error:</strong> <?= $role_status ?>
+ </span></p>
+ <?php else: ?>
+ <p class="item success">
+ Success!
+ </p>
+ <?php endif; ?>
+ <?php endif; ?>
+
+ <input type="hidden" name="type" value="role">
+ <input type="text" name="username" placeholder="Username">
+ <select name="role" required>
+ <option value="User">User</option>
+ <option value="Admin">Admin</option>
+ </select>
+ <input type="submit" value="Modify">
+ </form>
+
+<?php else: ?>
+ <h2>Permission denied, you're not an admin!</h2>
+
+<?php endif; ?>