-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
314 lines (227 loc) · 11 KB
/
dashboard.php
File metadata and controls
314 lines (227 loc) · 11 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?php
session_start();
include "php/db_conn.php";
if (isset($_SESSION['id']) && isset($_SESSION['user_name'])) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<!-- Google Web Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Poppins" rel="stylesheet" />
<!-- Favicon -->
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<!-- Icon Font Stylesheet -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css"
integrity="sha512-YWzhKL2whUzgiheMoBFwW8CKV4qpHQAEuvilg9FAn5VJUDwKZZxkJNuGM4XkWuk94WCrrwslk8yWNGmY1EduTA=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<!-- Customized Bootstrap Stylesheet -->
<link href="css/bootstrap.min.css" rel="stylesheet" />
<!-- Template Stylesheet -->
<link href="css/mainStyle.css?<?php echo time(); ?>" rel="stylesheet" />
</head>
<body>
<nav class="nav-left">
<div class="top-profile d-flex justify-content-center align-items-center m-auto">
<?php
$uname = $_SESSION['user_name'];
$sql = "SELECT * FROM admin WHERE user_name = '$uname'";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($result)) {
$imgUrl = $row['image_url'];
?>
<img src="images/<?php echo $row['image_url']; ?>" style="width: 60px; height: 60px; margin-right: 10px; ">
<?php
}
?>
<div>
<h1><?php echo $_SESSION['name'];?></h1>
<p>@<?php echo $_SESSION['user_name'];?></p>
</div>
</div>
<div class="menu">
<button class="menu-link btn active" onclick="openmenu('add')"><i class="fa-solid fa-image"></i> Galleries</button>
<button class="menu-link btn" onclick="openmenu('d-services')"><i class="fa-solid fa-laptop"></i> SERVICES</button>
<button class="menu-link btn" onclick="openmenu('message')"><i class="fa-solid fa-message"></i></i> Enquiries</button>
<button class="menu-link btn" onclick="openmenu('admin')"><i class="fa-solid fa-user"></i> Admin</button>
<a class="btn logout" href="php/logout.php"><i class="fa-solid fa-right-from-bracket"></i> Log out</a>
</div>
</nav>
<div class="container" id="main-area">
<div class="menu-contents active-menu" id="add">
<div class="container">
<button class="add-btn btn"><a href="new-image.php"><i class="fa-solid fa-plus"></i> ADD NEW IMAGE</a></button>
<table class="table table-bordered m-5">
<thead>
<tr class="text-center align-middle">
<th scope="col">Image</th>
<th scope="col">Category</th>
<th scope="col">Options</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM gallery";
$result = mysqli_query($conn, $sql);
$id = 1;
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$imgUrl = $row['image_url'];
$catg = $row['image_cat'];
?>
<tr class="text-center align-middle">
<td class="db-image"><img src="images/<?php echo $row['image_url']; ?>"></td>
<td><?php echo $catg?></td>
<td class="text-center">
<button class="btn btn-primary"><a href="php/editImg.php?edit=<?php echo $id ?>">
<i class="fa-solid fa-pen-to-square"></i> Edit</a></button>
<button class="btn btn-danger"><a href="php/deleteImg.php?delete=<?php echo $id ?>"><i class="fa-solid fa-trash"></i> Delete</a></button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="menu-contents" id="message">
<div class="container">
<table class="table table-bordered m-5">
<thead>
<tr class="text-center align-middle">
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Phone</th>
<th scope="col">Message</th>
<th scope="col">Options</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM message";
$result = mysqli_query($conn, $sql);
$id = 1;
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$email = $row['email'];
$phone = $row['phone'];
$message = $row['message'];
?>
<tr class="text-center align-middle">
<td><?php echo $name?></td>
<td><?php echo $email?></td>
<td><?php echo $phone?></td>
<td><?php echo $message?></td>
<td class="text-center">
<button class="btn btn-danger"><a
href="php/message-delete.php?delete=<?php echo $id ?>"><i class="fa-solid fa-trash"></i> Delete</a></button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="menu-contents" id="admin">
<div class="container">
<button class="add-btn btn"><a href="new-admin.php"><i class="fa-solid fa-plus"></i> ADD NEW ADMIN</a></button>
<table class="table table-bordered m-5">
<thead>
<tr class="text-center align-middle">
<th scope="col">Name</th>
<th scope="col">Username</th>
<th scope="col">Password</th>
<th scope="col">Image</th>
<th scope="col">Options</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM admin";
$result = mysqli_query($conn, $sql);
$id = 1;
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$username = $row['user_name'];
$password = $row['password'];
$imgUrl = $row['image_url'];
?>
<tr class="text-center align-middle">
<td><?php echo $name?></td>
<td><?php echo $username?></td>
<td><?php echo $password?></td>
<td class="db-image"><img src="images/<?php echo $row['image_url']; ?>"></td>
<td class="text-center">
<button class="btn btn-primary"><a href="php/edit.php?edit=<?php echo $id ?>"><i class="fa-solid fa-pen-to-square"></i> Edit</a></button>
<button class="btn btn-danger"><a href="php/delete.php?delete=<?php echo $id ?>"><i class="fa-solid fa-trash"></i> Delete</a></button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="menu-contents" id="d-services">
<div class="container">
<table class="table table-bordered m-5">
<thead>
<tr class="text-center align-middle">
<th scope="col">Name</th>
<th scope="col">1st Description</th>
<th scope="col">2nd Description</th>
<th scope="col">Price</th>
<th scope="col">Options</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM services";
$result = mysqli_query($conn, $sql);
$id = 1;
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$first_description = $row['first_description'];
$second_description = $row['second_description'];
$price = $row['price'];
?>
<tr class="text-center align-middle">
<td><?php echo $name?></td>
<td><?php echo $first_description?></td>
<td><?php echo $second_description?></td>
<td><?php echo $price?></td>
<td class="text-center">
<button class="btn btn-primary"><a href="php/editservices.php?edit=<?php echo $id ?>"><i class="fa-solid fa-pen-to-square"></i> Edit</a></button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
}else{
header("Location: admin.php");
exit();
}
?>
<!-- Customized JavScript -->
<script type="text/javascript" src="js/my-script.js"></script>
</body>
</html>