aboutsummaryrefslogtreecommitdiff
path: root/views/admin/index.php
blob: 69495d6e5e909e230dece4cf09626d87aef30297 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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; ?>