-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsers.php
More file actions
executable file
·77 lines (76 loc) · 3.24 KB
/
Users.php
File metadata and controls
executable file
·77 lines (76 loc) · 3.24 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php include("UserAuth.php"); ?>
<!DOCTYPE html>
<html>
<head>
<?php
include("htmlHead.html");
?>
<link href="stylesheet.css" rel="stylesheet">
</head>
<body>
<div class="mainHeader mb-3">
<?php
include("Header.php");
?>
</div>
<div class="content">
<?php
include "notifications.php";
?>
<div class="container">
<div class="row text-center">
<h1 class="display-4">Users</h1>
</div>
<div class="row text-center my-3">
<table class="mainTable table">
<thead>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Role</th>
<th scope="col">Email</th>
<th></th>
</thead>
<tbody>
<?php
require_once('database.php');
$query = 'SELECT ID, FirstName, LastName, Email, Role FROM Users;';
$result = $conn->query($query);
while ($row = $result->fetch_assoc()){
$id = $row['ID'];
$firstName = htmlspecialchars($row['FirstName'], ENT_QUOTES, 'UTF-8');
$lastName = htmlspecialchars($row['LastName'], ENT_QUOTES, 'UTF-8');
$email = htmlspecialchars($row['Email'], ENT_QUOTES, 'UTF-8');
$role = htmlspecialchars($row['Role'], ENT_QUOTES, 'UTF-8');
$seq = 1;
switch($role){
case "1":
$roleName = "Admin";
break;
case "2":
$roleName = "Editor";
break;
case "3":
$roleName = "Viewer";
break;
}
echo '<tr>
<td>' . $seq . '</td>
<td>' . $firstName . ' ' . $lastName . '</td>
<td>' . $roleName . '</td>
<td>' . $email . '</td>
<td><a href="editUser?id=' . $id . '" class="btn btn-sm myBtn">Edit</a></td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="Footer containter-fluid">
<?php
include ("Footer.php");
?>
</div>
</body>
</html>