-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_users.php
More file actions
178 lines (158 loc) · 6.46 KB
/
Copy pathadmin_users.php
File metadata and controls
178 lines (158 loc) · 6.46 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
session_start();
include 'DBConn.php';
// --- STANDARDIZED SECURITY GATE ---
// Matching the session logic used in your admin_dashboard.php
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
header("Location: admin_login.php");
exit();
}
// Fetch users from the 'users' table
$user_query = "SELECT id, full_name, email, role, created_at FROM users ORDER BY id ASC";
$users = mysqli_query($conn, $user_query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Customer Base | Pastimes® Terminal</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- FontAwesome 6 -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;700;900&display=swap');
:root {
--bg-pure: #000000;
--card-bg: #080808;
--border-dim: #222;
--accent-blue: #0678eb;
--text-muted: #aaa; /* Increased brightness for visibility */
}
body {
background-color: var(--bg-pure);
color: #fff;
font-family: 'Inter', sans-serif;
letter-spacing: -0.2px;
}
.page-header {
border-bottom: 1px solid var(--border-dim);
padding-bottom: 20px;
margin-bottom: 40px;
}
.fw-black { font-weight: 900; letter-spacing: 1px; }
/* Professional User Table Styling */
.user-table {
width: 100%;
border-collapse: separate;
border-spacing: 0 10px;
}
.user-table thead th {
text-transform: uppercase;
font-size: 11px;
font-weight: 800;
letter-spacing: 2px;
color: var(--text-muted); /* Brighter for readability */
padding: 15px;
}
.user-row {
background: var(--card-bg);
transition: 0.3s ease-in-out;
}
.user-row:hover {
background: #111;
}
.user-row td {
padding: 22px 15px;
border-top: 1px solid var(--border-dim);
border-bottom: 1px solid var(--border-dim);
vertical-align: middle;
color: #eee;
}
.user-row td:first-child { border-left: 1px solid var(--border-dim); }
.user-row td:last-child { border-right: 1px solid var(--border-dim); }
/* Role Badges */
.role-badge {
font-size: 10px;
text-transform: uppercase;
padding: 5px 12px;
border: 1px solid #333;
letter-spacing: 1px;
font-weight: 800;
display: inline-block;
}
.role-admin { border-color: var(--accent-blue); color: var(--accent-blue); }
.role-customer { border-color: #444; color: #fff; } /* White text for better customer visibility */
.btn-overview {
border-radius: 0;
font-size: 10px;
font-weight: 800;
text-transform: uppercase;
letter-spacing: 1px;
padding: 10px 20px;
transition: 0.2s;
}
.btn-overview:hover { background: #fff; color: #000; }
</style>
</head>
<body>
<div class="container py-5">
<!-- Header Section -->
<div class="d-flex justify-content-between align-items-end page-header">
<div>
<h2 class="fw-black m-0 text-uppercase" style="font-size: 2.5rem;">Customer Base</h2>
<p style="color: var(--text-muted); font-size: 11px; margin-top: 5px; text-transform: uppercase; letter-spacing: 1px;">
Directory Audit | <?php echo date('Y-m-d'); ?> | Midrand HQ
</p>
</div>
<a href="admin_dashboard.php" class="btn btn-outline-light btn-overview px-4">Return to Overview</a>
</div>
<!-- Directory Table -->
<div class="table-responsive">
<table class="user-table">
<thead>
<tr>
<th width="100">Index</th>
<th>Identity</th>
<th>Electronic Mail</th>
<th>System Role</th>
<th class="text-end">Registration Date</th>
</tr>
</thead>
<tbody>
<?php if ($users && mysqli_num_rows($users) > 0): ?>
<?php while($row = mysqli_fetch_assoc($users)): ?>
<tr class="user-row">
<td style="color: var(--text-muted); font-weight: 700; font-size: 13px;">
#0<?php echo str_pad($row['id'], 2, '0', STR_PAD_LEFT); ?>
</td>
<td>
<div class="fw-black text-uppercase" style="font-size: 14px; letter-spacing: 1px;">
<?php echo htmlspecialchars($row['full_name']); ?>
</div>
</td>
<td>
<div style="color: #fff; font-size: 13px;"><?php echo htmlspecialchars($row['email']); ?></div>
</td>
<td>
<span class="role-badge <?php echo ($row['role'] == 'admin') ? 'role-admin' : 'role-customer'; ?>">
<i class="fa-solid <?php echo ($row['role'] == 'admin') ? 'fa-user-shield' : 'fa-user'; ?> me-1"></i>
<?php echo strtoupper($row['role']); ?>
</span>
</td>
<td class="text-end">
<span style="color: var(--text-muted); font-size: 12px; font-weight: 600;">
<?php echo date('d M Y', strtotime($row['created_at'])); ?>
</span>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr><td colspan="5" class="text-center py-5 text-muted">No records identified in the directory.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>