-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
435 lines (427 loc) · 17.7 KB
/
admin.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
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
<?php
include_once('junk.php');
$que="SELECT * FROM `customer`";
$result = mysqli_query($db, $que);
$que1="SELECT * FROM `travel_agent`";
$result1 = mysqli_query($db, $que1);
$que2="SELECT * FROM `places`";
$result2 = mysqli_query($db, $que2);
$que3="SELECT * FROM `hotels`";
$result3 = mysqli_query($db, $que3);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/admin.css">
<title>Admin Page</title>
<style>
.container .addp-workspace{
width: 70vw;
height: 80vh;
float: right;
}
.container .addp-workspace .insert-pform{
display: none;
width: 30vw;
height: 50vh;
margin: 10% 30%;
text-align: center;
}
.container .addp-workspace .insert-pform input{
margin: 10px 0px;
}
</style>
<script>
function PopWindowOne(){
floatingWindow = window.open("calendar.html","","height=600,width=800,scrollbars=no");
}
</script>
</head>
<body>
<div class="main">
<ul>
<ul class="list">
<li class="logo"><a href="index.html"><img src="earth-globe.png" alt="Logo" style="width:36px;height:36px"></a></li>
<div class="search">
<form method="POST" action="info.php">
<input type="text" name="search_p" placeholder="Search.." size="50">
<input type="image" name="submit_p" src="search_icon.png" alt="Search image" style="width:22;height:22; margin-left: 35px;">
</form>
</div>
</ul>
<ul class="list2">
<li><a href="index.php">Home</a></li>
<li><a id="long" href="destination.html">Destination</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="signup.html">Sign Up</a></li>
<li><a href="feedback.html">Feedback</a></li>
<li><a href="#" onclick="PopWindowOne()">Calendar</a></li>
</ul>
</ul>
</div>
<div class="container">
<div class="headder">
<h1>Admin Page</h1>
</div>
<div class="menu-list">
<a id="a1" href="#" onclick="myFunction(document.getElementById(this.id))">Customers</a>
<a id="a2" href="#" onclick="myFunction(document.getElementById(this.id))">Travel Guides</a>
<a id="a3" href="#" onclick="myFunction(document.getElementById(this.id))">Places</a>
<a id="a4" href="#" onclick="myFunction(document.getElementById(this.id))">Hotels</a>
<a id="a5" href="#" onclick="myFunction(document.getElementById(this.id))">Add Place Information</a>
<a id="a6" href="#" onclick="myFunction(document.getElementById(this.id))">Add Ads</a>
<a id="a7" href="#" onclick="myFunction(document.getElementById(this.id))">Back</a>
</div>
<div class="customer-workspace work" id="id1">
<div class="btn-tag" id="cust-op">
<button type="button" id="v1" onclick="showDetails(document.getElementById(this.id))">view Customer detailes</button>
<button type="button" id="b1" onclick="deleteMenu(document.getElementById(this.id))">Delete customer</button>
</div>
<div id="tb-container" style="display: none; margin-top: 50px;">
<table align="center" border="1px" style="width: 700px; line-height: 30px;">
<tr>
<th colspan="7"><h2>Customer Details</h2></th>
</tr>
<tr>
<th>Id</th>
<th>First name</th>
<th>Password</th>
<th>Email</th>
<th>City</th>
<th>Phone</th>
</tr>
<?php
while($rows = mysqli_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $rows['id']; ?></td>
<td><?php echo $rows['fname']; ?></td>
<td><?php echo $rows['password']; ?></td>
<td><?php echo $rows['email']; ?></td>
<td><?php echo $rows['city']; ?></td>
<td><?php echo $rows['phone']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
<div class="delete-form" id="del-form">
<form method="POST" action="admin_op.php">
<input type="text" name="id" placeholder="customer ID" required><br>
<input type="text" name="fname" placeholder="First name" required><br>
<input type="text" name="lanme" placeholder="Last name" required><br>
<input type="submit" value="Delete" class="submit" name="de-submit-c">
</form>
</div>
</div>
<div class="agent-workspace work" id="id2">
<div class="btn-tag" id="agn-op">
<button type="button" id="v2" onclick="showDetails(document.getElementById(this.id))">view Guide detailes</button>
<button type="button" id="i1" onclick="insertMenu(document.getElementById(this.id))">Insert Guide</button>
<button type="button" id="b2" onclick="deleteMenu(document.getElementById(this.id))">Delete Guide</button>
</div>
<div id="agent-container" style="display: none; margin-top: 50px;">
<table align="center" border="1px" style="width: 700px; line-height: 30px;">
<tr>
<th colspan="5"><h2>Agent Details</h2></th>
</tr>
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>City</th>
<th>Type</th>
</tr>
<?php
while($rows1 = mysqli_fetch_assoc($result1))
{
?>
<tr>
<td><?php echo $rows1['aid']; ?></td>
<td><?php echo $rows1['afname']; ?></td>
<td><?php echo $rows1['aemail']; ?></td>
<td><?php echo $rows1['aphone']; ?></td>
<td><?php echo $rows1['acity']; ?></td>
<td><?php echo $rows1['type']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
<div class="insert-form" id="ins-form">
<form method="POST" action="admin_op.php">
<input type="text" name="aid" placeholder="Agent ID" required><br>
<input type="text" name="afname" placeholder="First name" required><br>
<input type="text" name="apass" placeholder="Password" required><br>
<input type="text" name="aemail" placeholder="Email" value="" required><br>
<input type="text" name="aphone" placeholder="Phone number" required><br>
<input type="text" name="acity" placeholder="City" required><br>
<h4 style="margin:0;">select guide type below</h4><br>
<select name="type" id="type" style="width: 170px;height:23px;">
<option value="Normal">Normal</option>
<option value="Normal">Special</option>
<option value="Medical">Medical</option>
<option value="Armed">Armed</option>
</select><br>
<input type="submit" value="Insert" class="submit" name="in-submit-a">
</form>
</div>
<div class="delete-form" id="del-form2">
<form method="POST" action="admin_op.php">
<input type="text" name="aid" placeholder="Agent ID" required><br>
<input type="text" name="afname" placeholder="First name" required><br>
<input type="submit" value="Delete" class="submit" name="de-submit-a">
</form>
</div>
</div>
<div class="places-workspace work" id="id3">
<div class="btn-tag" id="plc-op">
<button type="button" id="v3" onclick="showDetails(document.getElementById(this.id))">view place detailes</button>
<button type="button" id="i2" onclick="insertMenu(document.getElementById(this.id))">Insert place</button>
<button type="button" id="b3" onclick="deleteMenu(document.getElementById(this.id))">Delete place</button>
</div>
<div id="place-container" style="display: none; margin-top: 50px;">
<table align="center" border="1px" style="width: 500px; line-height: 30px;">
<tr>
<th colspan="3"><h2>Place Details</h2></th>
</tr>
<tr>
<th>Id</th>
<th>Place Name</th>
<th>City</th>
</tr>
<?php
while($rows2 = mysqli_fetch_assoc($result2))
{
?>
<tr>
<td><?php echo $rows2['pid']; ?></td>
<td><?php echo $rows2['pname']; ?></td>
<td><?php echo $rows2['pcity']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
<div class="insert-form" id="ins-form2">
<form method="POST" action="admin_op.php">
<input type="text" name="pid" placeholder="place ID" required><br>
<input type="text" name="pname" placeholder="Place name" required><br>
<input type="text" name="pcity" placeholder="City" required><br>
<input type="submit" value="Insert" class="submit" name="ins-submit-p">
</form>
</div>
<div class="delete-form" id="del-form3">
<form method="POST" action="admin_op.php">
<input type="text" name="pid" placeholder="place ID" required><br>
<input type="text" name="pname" placeholder="Place name" required><br>
<input type="submit" value="Delete" class="submit" name="de-submit-p">
</form>
</div>
</div>
<div class="hotels-workspace work" id="id4">
<div class="btn-tag" id="htl-op">
<button type="button" id="v4" onclick="showDetails(document.getElementById(this.id))">view hotel detailes</button>
<button type="button" id="i3" onclick="insertMenu(document.getElementById(this.id))">Insert hotel</button>
<button type="button" id="b4" onclick="deleteMenu(document.getElementById(this.id))">Delete hotel</button>
</div>
<div id="hotel-container" style="display: none; margin-top: 50px;">
<table align="center" border="1px" style="width: 500px; line-height: 30px;">
<tr>
<th colspan="4"><h2>Hotel Details</h2></th>
</tr>
<tr>
<th>Id</th>
<th>Hotel Name</th>
<th>Phone</th>
<th>City</th>
</tr>
<?php
while($rows3 = mysqli_fetch_assoc($result3))
{
?>
<tr>
<td><?php echo $rows3['hid']; ?></td>
<td><?php echo $rows3['hname']; ?></td>
<td><?php echo $rows3['hphone']; ?></td>
<td><?php echo $rows3['hcity']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
<div class="insert-form" id="ins-form3">
<form method="POST" action="admin_op.php">
<input type="text" name="hid" placeholder="hotel ID" required><br>
<input type="text" name="hname" placeholder="Hotel name" required><br>
<input type="text" name="hphone" placeholder="Phone number" required><br>
<input type="text" name="hcity" placeholder="City" required><br>
<input type="submit" value="Insert" class="submit" name="ins-submit-h">
</form>
</div>
<div class="delete-form" id="del-form4">
<form method="POST" action="admin_op.php">
<input type="text" name="hid" placeholder="hotel ID" required><br>
<input type="text" name="hname" placeholder="Hotel name" required><br>
<input type="submit" value="Delete" class="submit" name="de-submit-h">
</form>
</div>
</div>
<div class="addp-workspace work" id="id5" style="display: none;">
<div class="insert-pform" id="insp-form4">
<form method="POST" action="admin_op.php">
<input type="text" name="pname" placeholder="Place Name" required><br>
<textarea class="inputTextarea" name="pdescription" rows="4" class="form-control" placeholder="Please write place description here" required></textarea><br>
<input type="text" name="pi_main" placeholder="Enter main image" required><br>
<input type="text" name="pi1" placeholder="Enter image1" required><br>
<input type="text" name="pi2" placeholder="Enter image2" required><br>
<input type="text" name="pi3" placeholder="Enter image3" required><br>
<input type="text" name="temparature" placeholder="Enter temparature" required><br>
<input type="text" name="duration" placeholder="Enter duration" required><br>
<input type="submit" value="Add Place Details" class="submit" name="add_pd">
</form>
</div>
</div>
<div class="addp-workspace work" id="id6" style="display: none;">
<div class="insert-pform" id="insp-form5">
<form method="POST" action="admin_op.php">
<input type="text" name="aname" placeholder="Ads Name" required><br>
<input type="text" name="ad_img" placeholder="Enter ads image" required><br>
<input type="submit" value="Add New Ad" class="submit" name="add_ads">
</form>
</div>
</div>
</div>
<script type="text/javascript">
function makeNone(){
document.getElementById("htl-op").style.display = "none";
document.getElementById("ins-form3").style.display = "none";
document.getElementById("del-form4").style.display = "none";
document.getElementById("hotel-container").style.display = "none";
document.getElementById("plc-op").style.display = "none";
document.getElementById("ins-form2").style.display = "none";
document.getElementById("del-form3").style.display = "none";
document.getElementById("place-container").style.display = "none";
document.getElementById("agn-op").style.display = "none";
document.getElementById("ins-form").style.display = "none";
document.getElementById("del-form2").style.display = "none";
document.getElementById("agent-container").style.display = "none";
document.getElementById("cust-op").style.display = "none";
document.getElementById("del-form").style.display = "none";
document.getElementById("tb-container").style.display = "none";
}
function myFunction(clicked){
makeNone()
document.getElementById('id1').style.display = "none";
document.getElementById('id2').style.display = "none";
document.getElementById('id3').style.display = "none";
document.getElementById('id4').style.display = "none";
document.getElementById('id5').style.display = "none";
document.getElementById('id6').style.display = "none";
if (document.getElementById('a1') === clicked){
document.getElementById('id1').style.display = "block";
document.getElementById("cust-op").style.display = "block";
document.getElementById("del-form").style.display = "none";
}
if (document.getElementById('a2') === clicked){
document.getElementById('id2').style.display = "block";
document.getElementById("agn-op").style.display = "block";
document.getElementById("ins-form").style.display = "none";
document.getElementById("del-form2").style.display = "none";
}
if (document.getElementById('a3') === clicked){
document.getElementById('id3').style.display = "block";
document.getElementById("plc-op").style.display = "block";
document.getElementById("ins-form2").style.display = "none";
document.getElementById("del-form3").style.display = "none";
}
if (document.getElementById('a4') === clicked){
document.getElementById('id4').style.display = "block";
document.getElementById("htl-op").style.display = "block";
document.getElementById("ins-form3").style.display = "none";
document.getElementById("del-form4").style.display = "none";
}
if (document.getElementById('a5') === clicked){
document.getElementById('id5').style.display = "block";
document.getElementById("insp-form4").style.display = "block";
}
if (document.getElementById('a6') === clicked){
document.getElementById('id6').style.display = "block";
document.getElementById("insp-form5").style.display = "block";
}
}
function deleteMenu(clicked) {
if (document.getElementById('b1') === clicked){
document.getElementById("cust-op").style.display = "none";
document.getElementById("tb-container").style.display = "none";
document.getElementById("del-form").style.display = "block";
}
if (document.getElementById('b2') === clicked){
document.getElementById("agn-op").style.display = "none";
document.getElementById("agent-container").style.display = "none";
document.getElementById("del-form2").style.display = "block";
}
if (document.getElementById('b3') === clicked){
document.getElementById("plc-op").style.display = "none";
document.getElementById("place-container").style.display = "none";
document.getElementById("del-form3").style.display = "block";
}
if (document.getElementById('b4') === clicked){
document.getElementById("htl-op").style.display = "none";
document.getElementById("hotel-container").style.display = "none";
document.getElementById("del-form4").style.display = "block";
}
}
function insertMenu(clicked){
if (document.getElementById('i1') === clicked){
document.getElementById("agn-op").style.display = "none";
document.getElementById("agent-container").style.display = "none";
document.getElementById("ins-form").style.display = "block";
}
if (document.getElementById('i2') === clicked){
document.getElementById("plc-op").style.display = "none";
document.getElementById("place-container").style.display = "none";
document.getElementById("ins-form2").style.display = "block";
}
if (document.getElementById('i3') === clicked){
document.getElementById("htl-op").style.display = "none";
document.getElementById("hotel-container").style.display = "none";
document.getElementById("ins-form3").style.display = "block";
}
}
function showDetails(clicked){
if (document.getElementById('v1') === clicked){
document.getElementById("cust-op").style.display = "none";
document.getElementById("del-form").style.display = "none";
document.getElementById("tb-container").style.display = "block";
}
if (document.getElementById('v2') === clicked){
document.getElementById("agn-op").style.display = "none";
document.getElementById("ins-form").style.display = "none";
document.getElementById("del-form2").style.display = "none";
document.getElementById("agent-container").style.display = "block";
}
if (document.getElementById('v3') === clicked){
document.getElementById("plc-op").style.display = "none";
document.getElementById("ins-form2").style.display = "none";
document.getElementById("del-form3").style.display = "none";
document.getElementById("place-container").style.display = "block";
}
if (document.getElementById('v4') === clicked){
document.getElementById("htl-op").style.display = "none";
document.getElementById("ins-form3").style.display = "none";
document.getElementById("del-form4").style.display = "none";
document.getElementById("hotel-container").style.display = "block";
}
}
</script>
</body>
</html>