-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_dashboard.php
42 lines (40 loc) · 1.49 KB
/
admin_dashboard.php
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
</head>
<body>
<h2>User Admin Dashboard</h2>
<table border="1">
<thead>
<tr>
<th>ID</th>
<th>Username</th>
<th>Email</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td><?= htmlspecialchars($user['id']); ?></td>
<td><?= htmlspecialchars($user['username']); ?></td>
<td><?= htmlspecialchars($user['email']); ?></td>
<td><?= htmlspecialchars($user['role']); ?></td>
<td>
<a href="/admin/edit/<?= $user['id']; ?>">Edit</a> |
<form action="/admin/delete/<?= $user['id']; ?>" method="POST" style="display:inline;">
<!-- CSRF Token for delete action -->
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token']; ?>">
<button type="submit" onclick="return confirm('Are you sure you want to delete this user?')">Delete</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</body>
</html>