-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin-profile.php
More file actions
132 lines (123 loc) · 5.38 KB
/
Copy pathadmin-profile.php
File metadata and controls
132 lines (123 loc) · 5.38 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
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
<?php
include('config.php');
session_start();
// Prevent browser caching
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// Redirect to login if not logged in
if (!isset($_SESSION['student_id']) && !isset($_SESSION['admin_id'])) {
header("Location: index.php");
exit();
}
$admin_id = $_SESSION['admin_id'];
// Fetch student info from DB
$stmt = $conn->prepare("SELECT * FROM admins WHERE id = ?");
$stmt->bind_param("s", $admin_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$admin = $result->fetch_assoc();
} else {
echo "Admin not found.";
exit();
}
$role = $_SESSION['admin_role'] ?? '';
if ($role === 'super_admin') {
$dashboard_link = 'super-admin-dashboard.php';
} else {
$dashboard_link = 'admin-dashboard.php';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Profile</title>
<link rel="stylesheet" href="assets/css/sidebar.css" />
<link rel="stylesheet" href="assets/css/admin-profile.css" />
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, max-age=0" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
</head>
<body>
<nav id="sidebar">
<ul>
<li>
<span class="logo">SKIT</span>
<button id="toggle-btn">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3">
<path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z" />
</svg>
</button>
</li>
<li>
<a href="<?php echo $dashboard_link; ?>">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3">
<path
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h240v-560H200v560Zm320 0h240v-280H520v280Zm0-360h240v-200H520v200Z" />
</svg>
<span>Dashboard</span>
</a>
</li>
<li>
<a href="admin-view-grievances.php">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3">
<path
d="M200-200v-560 179-19 400Zm80-240h221q2-22 10-42t20-38H280v80Zm0 160h157q17-20 39-32.5t46-20.5q-4-6-7-13t-5-14H280v80Zm0-320h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v258q-14-26-34-46t-46-33v-179H200v560h202q-1 6-1.5 12t-.5 12v56H200Zm480-200q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM480-120v-56q0-24 12.5-44.5T528-250q36-15 74.5-22.5T680-280q39 0 77.5 7.5T832-250q23 9 35.5 29.5T880-176v56H480Z" />
</svg>
<span>View Grievances</span>
</a>
</li>
<li>
<a href="admin-action.php">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3">
<path
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z" />
</svg>
<span>Take Action</span>
</a>
</li>
<li class="active">
<a href="#">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3">
<path
d="M480-480q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47ZM160-160v-112q0-34 17.5-62.5T224-378q62-31 126-46.5T480-440q66 0 130 15.5T736-378q29 15 46.5 43.5T800-272v112H160Zm80-80h480v-32q0-11-5.5-20T700-306q-54-27-109-40.5T480-360q-56 0-111 13.5T260-306q-9 5-14.5 14t-5.5 20v32Zm240-320q33 0 56.5-23.5T560-640q0-33-23.5-56.5T480-720q-33 0-56.5 23.5T400-640q0 33 23.5 56.5T480-560Zm0-80Zm0 400Z" />
</svg>
<span>Profile</span>
</a>
</li>
</ul>
</nav>
<main>
<header>
<h1>Profile</h1>
<button id="logout-btn">
<a href="logout.php" class="logout-text">Logout</a>
</button>
</header>
<div class="profile-card">
<div class="avatar">
<img src="assets/images/<?= htmlspecialchars($admin['profile_image']) ?>" alt="Profile Image" />
</div>
<div class="profile-info">
<div><strong>Name:</strong><?= htmlspecialchars($admin['name']) ?></div>
<div><strong>Id:</strong> <?= htmlspecialchars($admin['id']) ?></div>
<div><strong>Role:</strong><?= htmlspecialchars($admin['role']) ?></div>
<div><strong>Department:</strong> <?= htmlspecialchars($admin['department']) ?><strong> Designation:</strong>
<?= htmlspecialchars($admin['designation']) ?></div>
<div><strong>Email ID:</strong> <?= htmlspecialchars($admin['email']) ?></div>
</div>
</div>
</main>
<script src="assets/JavaScript/sidebar.js" defer></script>
<script>
window.addEventListener('pageshow', function (event) {
if (event.persisted) {
window.location.reload();
}
});
</script>
</body>
</html>