-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminDashboard.php
142 lines (120 loc) · 3.93 KB
/
adminDashboard.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
<?php
session_start();
include_once('db_connection_short.php');
// Logout logic
if (isset($_POST['logout'])) {
session_destroy();
header("Location: login.php"); // Redirect to the login page after logout
exit();
}
?>
<!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>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f8f9fa;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
}
.container {
background-color: #ffffff;
border: 1px solid #ced4da;
border-radius: 5px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
width: 100%; /* Full-width container */
max-width: 1200px; /* Adjust max-width as needed */
box-sizing: border-box;
}
h2 {
color: #007bff;
margin-bottom: 20px;
position: relative;
left: 265px;
}
.dashboard {
display: flex;
justify-content: space-around; /* Adjust spacing */
margin-bottom: 20px;
}
.dashboard-item {
flex-basis: 45%; /* Adjust width */
margin-bottom: 20px; /* Adjust spacing */
}
.dashboard-item a {
display: block;
text-align: center;
padding: 40px; /* Adjust button size */
background-color: #007bff;
color: #fff;
text-decoration: none;
border-radius: 10px;
transition: background-color 0.3s ease;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.dashboard-item a:hover {
background-color: #0056b3;
}
.dashboard-item a.view-appointments {
background-image: url('view_appointments_image.jpg');
}
.dashboard-item a.certificate-generation {
background-image: url('certificate_generation_image.jpg');
}
.logout-btn {
background-color: #dc3545;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
position: relative;
left: 200px;
}
.logout-btn:hover {
background-color: #c82333;
}
</style>
</head>
<body>
<div class="container">
<?php
// Fetch admin details based on session
$admin_id = $_SESSION['admin_id'];
$admin_sql = "SELECT * FROM admin_users WHERE admin_id = $admin_id";
$admin_result = $conn->query($admin_sql);
if ($admin_result->num_rows > 0) {
$admin_row = $admin_result->fetch_assoc();
?>
<div class="dashboard">
<h2>Welcome, <?php echo $admin_row['name']; ?></h2>
<a href="logout.php"><button type="submit" class="logout-btn">Logout</button></a>
</div>
<div class="dashboard">
<div class="dashboard-item">
<a href="adminAppointment.php" class="view-appointments">View Appointments</a>
</div>
<div class="dashboard-item">
<a href="certificateGenerator.php" class="certificate-generation">Certificate Generation</a>
</div>
</div>
<?php
} else {
echo "<h2>Error fetching admin details.</h2>";
}
?>
</div>
</body>
</html>