forked from bhavanshu-1112/DBMS-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbookroom.php
More file actions
376 lines (326 loc) · 14.4 KB
/
Copy pathbookroom.php
File metadata and controls
376 lines (326 loc) · 14.4 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
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
<?php
session_start();
require_once "config.php";
$query="select * from reservations ";
$stmt=mysqli_prepare($conn, $query);
$result=$conn->query($query);
// if($_SESSION['username']==)
while($rows=$result->fetch_assoc()){
if(($rows['username']==$_SESSION['username']) && $rows['paid']==0){
echo '<script type="text/javascript">';
echo 'alert("Room successfully Booked!Proceed to payment.");';
echo 'window.location.href="billing.php";';
echo '</script>';
// header('location:billing.php');
}
}
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !==true){
header('Location: login.php');
exit;
} else{
if ($_SERVER['REQUEST_METHOD'] == "POST"){
$cin=$_POST['checkin'];
$cout=$_POST['checkout'];
$usr=$_SESSION["username"];
$sql="INSERT INTO reservations (username, name, room_no, checkin, checkout, number, paid) VALUES ('$usr',?, ?, '$cin', '$cout', ?, 0)";
$stmt=mysqli_prepare($conn, $sql);
// if($_POST['paid']==0 && ){}
if($stmt)
{
echo '<script language="javascript">';
echo 'alert("Room successfully Booked!Proceed to payment.")';
echo '</script>';
mysqli_stmt_bind_param($stmt,"sis",$para_name,$para_room,$para_number);
$para_number=$_POST['number'];
$para_room=$_POST['room_no'];
$para_name=$_POST['name'];
// $para_paid = $_POST['paid'];
if (mysqli_stmt_execute($stmt))
{
echo '<script type="text/javascript">';
echo 'alert("Room is successfully Booked!Redirecting you to payment.");';
echo 'window.location.href="billing.php";';
echo '</script>';
// header("location: billing.php");
}
else{
echo '<script language="javascript">';
echo 'alert("Something went wrong!")';
echo '</script>';
}
}
mysqli_close($conn);
}}
?>
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript">
function GetDays(){
var dropdt=new Date(document.getElementById("checkout"));
var n=dropdt.getSeconds();
var pickdt=new Date(document.getElementById("checkin"));
// document.getElementById("checkin").addEventListener("change", function() {
// let input1 = this.value;
// let pickdt = new Date(input1);});
// document.getElementById("checkout").addEventListener("change", function() {
// let input2 = this.value;
// let dropdt = new Date(input2);});
document.getElementById('cost').innerHTML=n;
return parseInt((dropdt.getTime()-pickdt.getTime())/(24*3600*1000));
}
function cal(){
if(document.getElementById("checkout")){
document.getElementById("numdays2").value=GetDays();
}
}
function price(){
document.getElementById("price").value=2000*GetDays();
// document.getElementById('cost').innerHTML=document.getElementById("price").value;
}
</script>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css?family=Parisienne|Tangerine:700&effect=neon" rel="stylesheet">
<link rel="shortcut icon" href="logo.ico" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!--<link rel="stylesheet" href="/assets/css/custom.css">-->
<title>Book a room</title>
</head>
<style>
h3{
color: white;
}
body{ /*body*/
background-image: url("bg1.jpg");
background-attachment: fixed;
background-size: cover;
font-family: 'Parisienne', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
h1{
color: rgb(185, 144, 45);
}
label{
color: white;
}
.text-center{
color: white;
}
.content{
background: linear-gradient(to right, rgba(238, 187, 69, 0.514), rgba(153, 108, 3, 0.514));
text-align: center;
color: wheat;
font-size: 25px;
border-radius: 9px;
margin:3%;
}
h2{ /*headings*/
text-shadow: 2px 2px rgb(39, 38, 38);
color: rgb(235, 226, 205);
}
.logo{
font-family: 'Tangerine', cursive;
font-size: 320px;
text-align: center; /*logo formatting*/
color: rgb(185, 144, 45);
text-shadow: 4px 4px 4px #aaa;
position: relative;
margin: auto;
}
/******************************************************
**************NAVBAR AND DROPDOWN**********************
******************************************************/
.navbar { /*navbar*/
position: sticky;
top: 0;
z-index: 2;
}
.navbar a { /* Links inside navbar */
float: left;
font-size: 30px;
color: rgb(185, 144, 45);
width: 14%;
text-align: center;
padding: 6px 11px;
text-decoration: none;
transition: 0.5s ease;
z-index: 2;
}
.dropdown { /* The dropdown container */
float: left;
overflow: hidden;
width: 18%;
}
#one{
font-size: 25px;
color: white;
}
.dropdown .dropbtn { /* Dropdown button */
font-size: 30px;
border: none;
outline: none;
color: rgb(185, 144, 45);
width: 100%;
padding: 6px 11x;
transition: 0.5s ease;
background-color: inherit;
font-family: inherit; /*vertical align on mobile phones */
margin: 0; /* vertical align on mobile phones */
}
.navbar a:hover, .dropdown:hover .dropbtn { /* change colors of links on hover*/
background-color: rgb(185, 144, 45);
color: white;
border-radius: 5px;
}
.dropdown-content { /* Dropdown content (hidden) */
display: none;
position: absolute;
font-size: 27px;
background-color: rgb(185, 144, 45);
width: 21%;
border-radius: 5px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 2;
}
.dropdown-content a { /* Links inside dropdown */
float: none;
color: rgba(26, 25, 25, 0.822);
padding: 5px 11px;
text-decoration: none;
display: block;
font-size: 24px;
text-align: left;
z-index: 1;
}
.dropdown-content a:hover { /* Add a grey background color to dropdown links on hover */
background-color: rgba(202, 175, 112, 0.356);
border-radius: 5px;
width: 91%;
}
.dropdown:hover .dropdown-content { /* Show the dropdown menu on hover */
display: block;
}
</style>
<body >
<!- /*************************************NAVBAR AND DROPDOWN*********************************************************************************/ ->
<div class="navbar">
<a href="main.php">Home</a>
<a href="bookroom.php">Book A Room</a>
<a href="facilities.php">Facilities</a>
<a href="nearby.php">Nearby</a>
<div class="dropdown">
<button class="dropbtn">
<?php if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !==true){ ?>
My Account
<?php }
else { ?>
<?php echo "Welcome ". $_SESSION['username']?>
<?php } ?>
</button>
<div class="dropdown-content">
<?php if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !==true){ ?>
<a href="login.php">Login</a>
<a href="register.php">Sign Up</a>
<?php }
else { ?>
<a href="Booking.php">My Bookings</a>
<a href="logout.php">Logout</a>
<?php } ?>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Our Locations
</button>
<div class="dropdown-content">
<a href="delhi.php">Delhi</a>
<a href="lucknow.php">Lucknow</a>
<a href="jaipur.php">Jaipur</a>
</div>
</div>
</div>
<br><br>
<!-- <div class="navbar">
<a href="main.php">Home</a>
<a href="bookroom.php">Book A Room</a>
<a href="facilities.php">Facilities</a>
<a href="#">Nearby</a>
<div class="dropdown">
<button class="dropbtn">My Account
</button>
<div class="dropdown-content">
<a href="login.php">Login</a>
<a href="register.php">Sign Up</a>
<a href="logout.php">Logout</a>
</div>
</div>
</div> -->
<div class="container">
<center> <h1 >
BOOK A ROOM
</h1></center>
<form class="add-customer-form" action="" method="POST">
<div class="form-row">
<div class="form-group col-md-6">
<label for="last-name">Full Name</label>
<input type="text" class="form-control" name="name" id="name" placeholder="Full Name" required>
</div>
<div class="form-group col-md-6">
<label for="last-name">Room type</label>
<select class="form-control" name = "room_no">
<option value="1">Luxury(Rs.2000/night)</option>
<option value="2">Deluxe(Rs.3500/night)</option>
<option value="3">Supreme(Rs.6000/night)</option>
<option value="4">Suite(Rs.8000/night)</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="last-name">Check In</label>
<input type="date" class="form-control" name="checkin" id="checkin" placeholder="Check in Date" required>
</div>
<div class="form-group col-md-6">
<label for="last-name">Check out</label>
<input type="date" class="form-control" name="checkout" id="checkout" placeholder="Check out Date" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="last-name">Phone No.</label>
<input type="text" name="number" class="form-control" pattern="[1-9]{1}[0-9]{9}" id="number" placeholder="10 digit Phone Number" required>
<!-- <input type="text" class="form-control" name="number" id="number" placeholder="Phone Number" required> -->
</div>
</div>
<!-- <div class="form-row">
<div class="form-group col-md-6">
<label for="last-name">Days of Stay:</label>
<label for="days" name="numdays2" id="numdays2" />
</div>
<div class="form-group col-md-6">
<label for="last-name">Total Amount:</label>
<label for="price" name="price" id="price" />
</div>
</div> -->
<center>
<br><div>
<button type="submit" class="btn btn-primary" >Book</button>
</div></center>
<br><br>
</form>
<br>
</div>
<br><br><br><br><br><br><br><br><br><br><br>
<div class="content">
<h2>
Atina Group Of Hotels <br>
</h2>
Quintessentially a traditional Indian brand in its DNA, The Atina Group of Hotels is one of the Leading Hotel Groups in India,
recognized throughout the nation for its unique flavor of hospitality and finesse. The Atina Group boasts of being one of the first 5 star hotels in India.
Atina firmly believe in sustainable luxury, adopting eco-friendly ways and sustainable energy that can be adopted by the hospitality industry.
With 5-star business and leisure hotels in the city of Jaipur, Lucknow and Delhi, Atina offers its guests sustainable luxury,
efficient services and amenities and a touch of heritage with an assurance of high levels of quality. <br>
</div>
</body>
</html>