-
Notifications
You must be signed in to change notification settings - Fork 5
/
status1.php
128 lines (93 loc) · 3.43 KB
/
status1.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
<!--status1 for room booking management-->
<?php
session_start();
$con=mysqli_connect('localhost','root','','hotelmanagement');
$Sno = (isset($_POST['SNo']) ? $_POST['SNo'] : 'error');
$Type = (isset($_POST['Type']) ? $_POST['Type'] : 'error');
$ID = (isset($_POST['ID']) ? $_POST['ID'] : 'error');
$Name = (isset($_POST['Name']) ? $_POST['Name'] : 'error');
$Rno = (isset($_POST['NoRoom']) ? $_POST['NoRoom'] : 'error');
//$name=$_SESSION['name'];
if(isset($_POST['accept']))
{
$query="UPDATE room SET Status =true WHERE SNo='$Sno'";
mysqli_query($con,$query);
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/new/admin.php#room">';
}
else if(isset($_POST['pay']))
{
$query="UPDATE room SET Status ='paid' WHERE SNo='$Sno'"; $sel="select * from $Type";
$num =mysqli_query($con,$sel);
while($row=mysqli_fetch_assoc($num))
{
$sno=$row['SNo'];
if ($row['Availability']==1)
{
$avail="UPDATE $Type SET Availability =false,Name='$Name',ID='$ID' WHERE SNo ='$sno' ";
break ;
}
}
mysqli_query($con,$avail);
mysqli_query($con,$query);
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/new/appointment.php#room">';
}
else if (isset($_POST['free'])){
$query="DELETE FROM room WHERE SNo ='$Sno'";
$sel="select * from $Type";
$num =mysqli_query($con,$sel);
while($row=mysqli_fetch_assoc($num))
{
$sno=$row['SNo'];
if ($row['Availability']==0)
{
$avail="UPDATE $Type SET Availability =true,Name='',ID='' WHERE SNo ='$sno'AND ID='$ID' AND Name='$Name' ";
break ;
}
}
mysqli_query($con,$avail);
mysqli_query($con,$query);
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/new/admin.php#expired">';
}
else if (isset($_POST['Rfree'])){
$query="DELETE FROM room WHERE SNo ='$Sno'";
mysqli_query($con,$query);
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/new/admin.php#rejected">';
}
else if(isset($_POST['reject']))
{
$query="UPDATE room SET Status =false WHERE SNo='$Sno'";
mysqli_query($con,$query);
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/new/admin.php#room">';
}
else if(isset($_POST['add']))
{ $i=0;
while($i<$Rno){
$i++;
$query="insert into $Type (Availability) values('1')";
mysqli_query($con,$query);
}
echo "<script>alert('Room is added'); window.location.href='http://localhost/new/admin.php#add'; </script>";
}
else if(isset($_POST['delete']))
{ $i=0;
$sel="select * from $Type";
$num =mysqli_query($con,$sel);
while($row=mysqli_fetch_assoc($num))
{
$sno=$row['SNo'];
}
echo $sno;
while($i<$Rno){
$query="DELETE FROM $Type WHERE SNo='$sno'";
mysqli_query($con,$query);
$i++;
$sno--;
}
echo "<script>alert('Room is deleted'); window.location.href='http://localhost/new/admin.php#add'; </script>";
}
else {
$query="UPDATE room SET Status ='cancel' WHERE SNo='$Sno'";
mysqli_query($con,$query);
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/new/appointment.php#room">';
}
?>