Last change
on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 7 days ago |
Upload new project files
|
-
Property mode
set to
100644
|
File size:
2.8 KB
|
Rev | Line | |
---|
[f9c482b] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | session_start();
|
---|
| 4 |
|
---|
| 5 | if(!isset($_SESSION['user_ID']) || !isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
|
---|
| 6 | header("Location: ./Log In.php");
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | require "./connect.php";
|
---|
| 10 |
|
---|
| 11 | $res = $conn->query("SELECT * FROM users", MYSQLI_USE_RESULT);
|
---|
| 12 | ?>
|
---|
| 13 |
|
---|
| 14 | <!DOCTYPE html>
|
---|
| 15 | <html lang="en">
|
---|
| 16 | <head>
|
---|
| 17 | <meta charset="UTF-8">
|
---|
| 18 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
---|
| 19 | <link rel="stylesheet" href="./CSS/FetchData.css">
|
---|
| 20 | <title>Users</title>
|
---|
| 21 | </head>
|
---|
| 22 | <body>
|
---|
| 23 | <div class="container">
|
---|
| 24 | <div class="row">
|
---|
| 25 | <div class="col">
|
---|
| 26 | <div class="card">
|
---|
| 27 | <div class="card-header">
|
---|
| 28 | <h2>Users</h2>
|
---|
| 29 | </div>
|
---|
| 30 | <div class="card-body">
|
---|
| 31 | <table class="table-container">
|
---|
| 32 | <tr>
|
---|
| 33 | <th>User ID</th>
|
---|
| 34 | <th>Username</th>
|
---|
| 35 | <th>Email</th>
|
---|
| 36 | <th>Password</th>
|
---|
| 37 | <th>Is Admin</th>
|
---|
| 38 | <th></th>
|
---|
| 39 | </tr>
|
---|
| 40 | <tr>
|
---|
| 41 | <?php
|
---|
| 42 | while($row = mysqli_fetch_assoc($res)){
|
---|
| 43 | ?>
|
---|
| 44 | <td><?php echo $row['user_ID']?></td>
|
---|
| 45 | <td><?php echo $row['username']?></td>
|
---|
| 46 | <td><?php echo $row['email']?></td>
|
---|
| 47 | <td><?php echo $row['password']?></td>
|
---|
| 48 | <td><?php echo (($row["is_admin"] == 1) ? "TRUE" : "FALSE" ) ?></td>
|
---|
| 49 | <td>
|
---|
| 50 | <?php
|
---|
| 51 | if($row["is_admin"] == 1) {
|
---|
| 52 | echo "<a class=\"already-admin-button\">Admin</a>";
|
---|
| 53 | }
|
---|
| 54 | else { ?>
|
---|
| 55 | <a href="./SetUserAdmin.php?user_id=<?php echo $row["user_ID"] ?>" class="make-admin-button">Make Admin</a>
|
---|
| 56 | <?php
|
---|
| 57 | } ?>
|
---|
| 58 | </td>
|
---|
| 59 | </tr>
|
---|
| 60 | <?php
|
---|
| 61 | }
|
---|
| 62 | ?>
|
---|
| 63 | </table>
|
---|
| 64 | </div>
|
---|
| 65 | </div>
|
---|
| 66 | </div>
|
---|
| 67 | </div>
|
---|
| 68 | </div>
|
---|
| 69 | </body>
|
---|
| 70 | </html> |
---|
Note:
See
TracBrowser
for help on using the repository browser.