-
Notifications
You must be signed in to change notification settings - Fork 0
/
freeRoom.php
65 lines (52 loc) · 1.35 KB
/
freeRoom.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
<?include_once("global.php");?>
<?
if ($logged==0){
?>
<script type="text/javascript">
window.location = "./";
</script>
<?
}
$room = $_GET["room"];
if(isset($_GET["room"])){
$room = $_GET["room"];
if((!$room)){
$message = "Please insert both fields.";
}
else{
//go
//update room status
//get tracking id
$query_makingRoomsExpire = "select
r.bookingId
from lib_bookings b inner join lib_room r on r.bookingId = b.bookingId where r.room = '$room'
";
$result_makingRoomsExpire = $con->query($query_makingRoomsExpire);
if ($result_makingRoomsExpire->num_rows > 0)
{
while($row = $result_makingRoomsExpire->fetch_assoc())
{
$bookingId = $row['bookingId'];
}
}
//
$expiry = time()-10;
$sql="update lib_bookings set status='free', expiry='$expiry' where room='$room' and bookingId = '$bookingId'";
if(!mysqli_query($con,$sql))
{
echo"can not";
}
$sql="update lib_room set status='free' where room='$room'";
if(!mysqli_query($con,$sql))
{
echo"can not";
}
?>
<script type="text/javascript">
window.location = "./dashboard.php";
</script>
<?
}}
?>
<html>
</html>