-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmindash.php
161 lines (137 loc) · 2.56 KB
/
admindash.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
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
<?php
session_start();
if(!isset($_SESSION["isAdmin"]) || $_SESSION["isAdmin"] !== true){
header('Location: adminLogin.php');
exit;
}?>
<!DOCTYPE html>
<html>
<head>
<title>KaMM</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
background-color: rgb(40, 126, 206);
color: #fff;
padding: 20px;
}
.logo a {
color: #fff;
font-size: 24px;
text-decoration: none;
}
nav ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
nav ul li {
margin-left: 20px;
}
nav ul li a {
color: #fff;
text-decoration: none;
}
main {
padding: 50px;
height: 90vh;
}
h1 {
font-size: 36px;
margin-bottom: 20px;
}
.table-container {
margin-bottom: 50px;
}
table {
border-collapse: collapse;
width: 100%;
}
thead {
background-color: rgb(40, 126, 206);
color: #fff;
}
th,
td {
padding: 10px;
text-align: left;
border-bottom: 1px solid #ccc;
}
th:first-child,
td:first-child {
text-align: center;
}
th:last-child,
td:last-child {
text-align: right;
}
th {
font-weight: bold;
}
footer {
background-color:rgb(40, 126, 206) ;
color: #fff;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<header>
<div class="logo">
<a href="#">KaMM</a>
</div>
<nav>
<ul>
<li><a href="AdminHome.php">Home</a></li>
</ul>
</nav>
</header>
<main>
<h1>Total Administrators</h1>
<section class="table-container">
<h2>Admin List</h2>
<table>
<thead>
<tr>
<th>Customer ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php
// Create a PDO instance and connect to the database
$db = new PDO('mysql:host=localhost;dbname=list', 'root', '');
// Prepare the SQL query to fetch data from the "customer" table
$sql = "SELECT * FROM admin";
$stmt = $db->prepare($sql);
// Execute the query
$stmt->execute();
$i=1;
// Fetch and display the results
while ($row = $stmt->fetch()) {
echo "<tr>";
echo "<td>" .$i++."</td>";
echo "<td>" . $row['fname'] ." ". $row['lname']. "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</section>
</main>
<footer>
<p>© 2023 KaMM</p>
</footer>
</body>
</html>