-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_dashboard.php
102 lines (87 loc) · 2.97 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
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
<?php
session_start();
// Check if admin is logged in
if (!isset($_SESSION['admin_id'])) {
header("Location: admin_login.html");
exit;
}
// Database configuration
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "6th";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch check-in data
$sql = "
SELECT u.email, u.age, u.profession, u.skills, d.checkin_date
FROM users u
LEFT JOIN daily_checkins d ON u.id = d.user_id
ORDER BY u.email, d.checkin_date DESC
";
$result = $conn->query($sql);
// Close connection
$conn->close();
?>
<!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>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<style>
.checkin-table {
margin-top: 20px;
}
.checkin-table th, .checkin-table td {
text-align: center;
}
</style>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="index.html">6TH UNION - Admin</a>
</nav>
</header>
<div class="container mt-5">
<h2>Admin Dashboard</h2>
<table class="table table-bordered checkin-table">
<thead>
<tr>
<th>Username</th>
<th>Full Name</th>
<th>Check-In Date</th>
</tr>
</thead>
<tbody>
<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . htmlspecialchars($row['username']) . "</td>";
echo "<td>" . htmlspecialchars($row['fullName']) . "</td>";
echo "<td>" . htmlspecialchars($row['checkin_date']) . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='5'>No check-in records found.</td></tr>";
}
?>
</tbody>
</table>
</div>
<footer class="bg-dark text-white text-center py-3">
<p>Copyright © 2023 6TH UNION Foundation. All Rights Reserved.</p>
</footer>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>