-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
91 lines (87 loc) · 3.37 KB
/
Copy pathadmin.php
File metadata and controls
91 lines (87 loc) · 3.37 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
<?php
session_start();
include 'DBConn.php';
// Security: Only allow Admins to see this page[cite: 2]
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
header("Location: authenticate.php");
exit();
}
// Fetch all Users and Clothes
$users = $conn->query("SELECT * FROM tblUser");
$clothes = $conn->query("SELECT * FROM tblClothes");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin Panel | Pastimes®</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body { background-color: #000; color: #fff; font-family: 'Inter', sans-serif; }
.container { margin-top: 50px; }
.table { background: #111; color: #fff; border: 1px solid #333; }
.btn-action { text-transform: uppercase; font-weight: 800; font-size: 10px; letter-spacing: 1px; }
.status-pending { color: #ffcc00; }
.status-approved { color: #00ff00; }
</style>
</head>
<body>
<div class="container">
<h2 class="text-uppercase mb-5">Admin Dashboard</h2>
<!-- User Management Section[cite: 7, 8] -->
<h4 class="mb-3">Customer Verification</h4>
<table class="table mb-5">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php while($row = $users->fetch_assoc()): ?>
<tr>
<td><?php echo $row['username']; ?></td>
<td><?php echo $row['email']; ?></td>
<td class="status-<?php echo strtolower($row['status']); ?>"><?php echo $row['status']; ?></td>
<td>
<?php if($row['status'] == 'Pending'): ?>
<a href="admin_actions.php?approve_id=<?php echo $row['userID']; ?>" class="btn btn-sm btn-success btn-action">Approve</a>
<?php endif; ?>
<a href="admin_actions.php?delete_user=<?php echo $row['userID']; ?>" class="btn btn-sm btn-danger btn-action">Remove</a>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<!-- Clothing Inventory Section[cite: 2, 8] -->
<div class="d-flex justify-content-between mb-3">
<h4>Inventory</h4>
<a href="add_item.php" class="btn btn-outline-light btn-action">Add New Item</a>
</div>
<table class="table">
<thead>
<tr>
<th>Item</th>
<th>Price</th>
<th>Stock</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php while($row = $clothes->fetch_assoc()): ?>
<tr>
<td><?php echo $row['clothName']; ?></td>
<td>R<?php echo $row['price']; ?></td>
<td><?php echo $row['stockQuantity']; ?></td>
<td>
<a href="edit_item.php?id=<?php echo $row['clothID']; ?>" class="btn btn-sm btn-light btn-action">Edit</a>
<a href="admin_actions.php?delete_cloth=<?php echo $row['clothID']; ?>" class="btn btn-sm btn-danger btn-action">Delete</a>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</body>
</html>