-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
48 lines (44 loc) · 1.27 KB
/
admin.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin Panel - School SMP</title>
<script defer src="auth.js"></script>
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="logout.html">Logout</a></li>
</ul>
</nav>
<main>
<h1>Admin Panel</h1>
<p>Welcome, Owner!</p>
<h2>User List</h2>
<div id="userList"></div>
</main>
<footer>
<p>© 2025 School SMP. All rights reserved.</p>
<p>Powered by School SMP</p>
</footer>
<script>
// Admin-only page (only visible if the user is the owner)
const currentUser = JSON.parse(localStorage.getItem('currentUser'));
if (currentUser.role !== 'owner') {
window.location.href = 'index.html'; // Redirect if not the owner
}
// Display list of users
const userListDiv = document.getElementById('userList');
const users = getUsers();
const userListHTML = Object.keys(users).map(email => `
<div>
<p><strong>${users[email].name}</strong> (${email})</p>
<p>Role: ${users[email].role}</p>
</div>
`).join('');
userListDiv.innerHTML = userListHTML;
</script>
</body>
</html>