-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.php
59 lines (45 loc) · 1.26 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
ob_start();
include 'inc/navbar.php';
if (!isset($_SESSION['is_admin'])) {
header('Location: signup.php');
exit;
}
$query = "SELECT COUNT(*) AS user_count FROM users";
$result = mysqli_query($conn, $query);
if ($result) {
$row = mysqli_fetch_assoc($result);
$user_count = $row['user_count'];
} else {
echo "Error executing query: " . mysqli_error($conn);
}
$query = "SELECT COUNT(*) AS order_count FROM orders WHERE DATE(order_date) = CURDATE()";
$result = mysqli_query($conn, $query);
if ($result) {
$row = mysqli_fetch_assoc($result);
$order_count = $row['order_count'];
} else {
echo "Error executing query: " . mysqli_error($conn);
}
mysqli_close($conn);
ob_end_flush();
?>
<div class="dashboard-container">
<?php include 'inc/aside.php'; ?>
<div class="general-info">
<div class="info">
<div><i class="fa-solid fa-user"></i>
<h2>Users</h2>
</div>
<span><?php echo $user_count ?></span>
</div>
<div class="info">
<div>
<i class="fa-solid fa-utensils"></i>
<h2>Orders</h2>
</div>
<span><?php echo $order_count ?></span>
</div>
</div>
</div>
<?php include 'inc/footer.php'; ?>