-
Notifications
You must be signed in to change notification settings - Fork 0
/
reserve.php
389 lines (334 loc) · 15.1 KB
/
reserve.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
<?php
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&family=Merriweather&family=Merriweather+Sans&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
<style>
.font-50px a{
font-size: 25px;
}
.x{
position: relative;
margin-left: 20px;
margin-right: 20px;
}
</style>
<script src="sweetalert2.min.js"></script>
<link rel="stylesheet" href="sweetalert2.min.css">
<title>HOSTEL WORLD</title>
</head>
<body>
<?php if (isset($_SESSION['success'])) : ?>
<div class="error success" >
<h3>
<?php
echo $_SESSION['success'];
unset($_SESSION['success']);
?>
</h3>
</div>
<?php endif ?>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
<!-- navigation bar -->
<div class="navigation">
<nav class="navbar fixed-top navbar-expand-lg navbar-dark navigations">
<div class="container-fluid">
<a class="navbar-brand" href="/project/index.php">HOSTEL WORLD</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/project/index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/project/hostels.php">Hostels</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/project/myhostels.php">My Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/project/about.php">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/project/contact.php">Contact Us</a>
</li>
<?php
if($_SESSION['loggin']){
echo "</li>
<li class='nav-item'>
<a class='nav-link'href='index.php?logout='1''>LOGOUT</a>
</li>";
}
?>
</ul>
<div class="d-flex">
<?php
if(!$_SESSION['loggin']){
echo '<a class="navbar-brand" href="login.php">
<img src="https://img.icons8.com/color/48/000000/user.png" alt="" width="30" height="24" class="d-inline-block align-text-top">User Login
</a>
<a class="navbar-brand" href="admin_login.php">
<img src="https://img.icons8.com/external-itim2101-lineal-color-itim2101/64/000000/external-admin-network-technology-itim2101-lineal-color-itim2101-1.png" alt="" width="30" height="24" class="d-inline-block align-text-top">Admin
Login
</a>';
}
?>
<?php if (isset($_SESSION['username'])) : ?>
<p><img src="https://img.icons8.com/metro/26/000000/guest-male.png"><button class="btn btn-primary" type="submit"> <a href="myhostels.php" style="color: white; text-decoration:none"><?php echo $_SESSION['username']; ?></a></button> </p>
<?php endif ?>
</div>
</nav>
</div>
<br>
<br><br>
<div class="container">
<section class="vh-100 gradient-custom">
<div class="container py-5 h-100">
<div class="row justify-content-center align-items-center h-100">
<div class="col-12 col-lg-9 col-xl-7">
<div class="card shadow-2-strong card-registration" style="border-radius: 15px;">
<div class="card-body p-4 p-md-5">
<h3 class="mb-4 pb-2 pb-md-0 mb-md-5">Reservation Form</h3>
<form method="POST">
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<label class="form-label">Name</label>
<input type="text" name="Name" class="form-control form-control-lg" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4 d-flex align-items-center">
<div class="form-outline datepicker w-100">
<label for="birthdayDate" class="form-label">Birthday</label>
<input type="date" name="dob"class="form-control form-control-lg"id="birthdayDate"/>
</div>
</div>
<div class="col-md-6 mb-4">
<h6 class="mb-2 pb-1">Gender: </h6>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="gender"
id="femaleGender"
value="female"
checked
/>
<label class="form-check-label" for="female">Female</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="gender"
id="maleGender"
value="male"
/>
<label class="form-check-label" for="male">Male</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="gender"
id="otherGender"
value="others"
/>
<label class="form-check-label" for="other">Other</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4 pb-2">
<div class="form-outline">
<label class="form-label" for="emailAddress">Email</label>
<input type="email" id="emailAddress"name="email" class="form-control form-control-lg" />
</div>
</div>
<div class="col-md-6 mb-4 pb-2">
<div class="form-outline">
<label class="form-label" for="phoneNumber">Phone Number</label>
<input type="text" id="phoneNumber" name="phoneno"class="form-control form-control-lg" />
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<label class="form-label select-label"> Category</label>
<select class="select form-control-lg"name="category_id">
<option value="1" disabled>--Choose One--</option>
<option value="1">Category A</option>
<option value="2">Category B</option>
<option value="3">Category C</option>
</select>
</div>
<div class="col-6">
<label class="form-label select-label"> Room Type</label>
<select class="select form-control-lg"name="room">
<option value="1" disabled>--Choose One--</option>
<option value="1">Single BED</option>
<option value="2">Double Share</option>
<option value="3">Triple Share</option>
</select>
</div>
</div>
<div class="mt-4 pt-2">
<button type="submit"class="btn btn-primary btn-lg" name="submit">SEND</button>
<button type="reset" class="btn btn-primary btn-lg"name="submit">RESET</button>
</div>
<?php
include 'connection.php';
$x = $_SESSION['username'];
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$query1 = "SELECT * FROM student WHERE username='$x'";
$data1 = mysqli_query($conn, $query1);
$result1 = mysqli_fetch_assoc($data1);
$student_id = $result1['id'];
$hostel_id=$_GET['id'];
$query="SELECT * FROM hostels WHERE hostel_id='$hostel_id'";
$data=mysqli_query($conn,$query);
$result=mysqli_fetch_assoc($data);
$hostel_name=$result['hostel_name'];
$owner=$result['owner_id'];
if(isset($_POST['submit'])){
$sname=$_POST['Name'];
$gender=$_POST['gender'];
$birthday=$_POST['dob'];
$email=$_POST['email'];
$phone=$_POST['phoneno'];
$category=$_POST['category_id'];
$room=$_POST['room'];
$query= "insert into reserve
(name,gender,birthday,hostel_id,hostel_name,category_id,room_type,email,phoneno,student_id,owner_id)
values ('$sname','$gender','$birthday','$hostel_id','$hostel_name','$category','$room','$email','$phone','$student_id','$owner')";
$run=mysqli_query($conn,$query) or die(mysqli_error($conn));
if($run)
echo "Message sent successfully!!!!";
else
echo "Message not sent!!!!!";
}
?>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Remove the container if you want to extend the Footer to full width. -->
<div class="footer">
<!-- Footer -->
<footer class="text-center text-white" style="background-color:rgb(209 20 80) ;">
<!-- Grid container -->
<div class="container">
<!-- Section: Links -->
<section class="mt-5">
<!-- Grid row-->
<div class="row text-center d-flex justify-content-center pt-5">
<!-- Grid column -->
<div class="col-md-2">
<h6 class="text-uppercase font-weight-bold">
<a href="/project/about.php" class="text-white">About us</a>
</h6>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-2">
<h6 class="text-uppercase font-weight-bold">
<a href="/project/hostels.php" class="text-white">Hostels</a>
</h6>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-2">
<h6 class="text-uppercase font-weight-bold">
<a href="#!" class="text-white">Review</a>
</h6>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-2">
<h6 class="text-uppercase font-weight-bold">
<a href="/project/contact.php" class="text-white">Help</a>
</h6>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-2">
<h6 class="text-uppercase font-weight-bold">
<a href="/project/contact.php" class="text-white">Contact</a>
</h6>
</div>
<!-- Grid column -->
</div>
<!-- Grid row-->
</section>
<!-- Section: Links -->
<hr class="my-5" />
<!-- Section: Text -->
<section class="mb-5">
<div class="row d-flex justify-content-center">
<div class="col-lg-8">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt distinctio earum repellat
quaerat voluptatibus placeat nam, commodi optio pariatur est quia magnam eum harum
corrupti dicta, aliquam sequi voluptate quas.
</p>
</div>
</div>
</section>
<!-- Section: Text -->
<!-- Section: Social -->
<section class="text-center mb-5">
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-instagram"></a>
</section>
<!-- Section: Social -->
</div>
<!-- Grid container -->
<!-- Copyright -->
<!-- Copyright -->
</footer>
<!-- Footer -->
</div>
<!-- End of .container -->
</body>
</html>