-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_dashboard.php
More file actions
94 lines (94 loc) · 4.77 KB
/
admin_dashboard.php
File metadata and controls
94 lines (94 loc) · 4.77 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
<?php
session_start();
$section = $_GET['section'] ?? 'users';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900&display=swap" rel="stylesheet">
<title>Admin Dashboard</title>
</head>
<body>
<header>
<nav>
<div class="nav_logo">
<h1><a href="index.php">Hangout Planner</a></h1>
</div>
<ul class="nav_link">
<li><a href="home.php">Home</a></li>
<li><a href="#" onclick="document.getElementById('section_form_users').submit();">Users</a></li>
<li><a href="#" onclick="document.getElementById('section_form_plans').submit();">Hangout Plans</a></li>
</ul>
</nav>
</header>
<main>
<section class="admin_section">
<div class="admin_box">
<h1><?php echo ucfirst($section); ?> List</h1>
<form id="section_form_users" action="admin.php" method="post">
<input type="hidden" name="section" value="users">
</form>
<form id="section_form_plans" action="hangout_alist.php" method="post">
<input type="hidden" name="section" value="plans">
</form>
<table class="admin_table">
<thead>
<?php
if (isset($_SESSION['admin_dashboard_results']) && !empty($_SESSION['admin_dashboard_results'])) {
$results = $_SESSION['admin_dashboard_results'];
if ($section == 'users') {
echo "<p>Here are the users:</p>";
echo "<tr>
<th>Email</th>
<th>First Name</th>
<th>Middle Name</th>
<th>Last Name</th>
<th>Phone Number</th>
<th>Date of Birth</th>
<th>Sex</th>
<th>Action</th>
</tr>";
}
?>
</thead>
<tbody>
<?php
if (isset($_SESSION['admin_dashboard_results']) && !empty($_SESSION['admin_dashboard_results'])) {
$results = $_SESSION['admin_dashboard_results'];
foreach ($results as $row) {
if ($section == 'users') {
echo "<tr>";
echo "<td>" . htmlspecialchars($row["Email"]) . "</td>";
echo "<td>" . htmlspecialchars($row["f_name"]) . "</td>";
echo "<td>" . htmlspecialchars($row["m_name"]) . "</td>";
echo "<td>" . htmlspecialchars($row["l_name"]) . "</td>";
echo "<td>" . htmlspecialchars($row["phone_no"]) . "</td>";
echo "<td>" . htmlspecialchars($row["DOB"]) . "</td>";
echo "<td>" . htmlspecialchars($row["Sex"]) . "</td>";
echo "<td style='background-color:rgba(255, 255, 255, 0.2);'>";
echo "<a style='text-decoration:none;' href='modify_user.php?id=" . htmlspecialchars($row['Email']) . "'>";
echo "<img src='img/update.png' alt='update' width='18' height='18'/>";
echo "</a>";
echo "<a style='text-decoration:none; margin-left: 15px;' href='delete_user.php?id=" . htmlspecialchars($row['Email']) . "' onclick='return confirm(\"Confirm deletion?\");'>";
echo "<img src='img/delete.png' alt='delete' width='18' height='18'/>";
echo "</a>";
echo "</td>";
echo "</tr>";
}
unset($_SESSION['admin_dashboard_results']);
}
}
}
?>
</tbody>
</table>
</div>
</section>
</main>
</body>
</html>