-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathpnrstatus.php
81 lines (80 loc) · 2.25 KB
/
pnrstatus.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
<?php
session_start();
$conn = mysqli_connect("localhost","root","","railway");
if(!$conn){
echo "<script type='text/javascript'>alert('Database failed');</script>";
die('Could not connect: '.mysqli_connect_error());
}
if (isset($_POST['submit']))
{
$pnr=$_POST['pnr'];
$sql = "SELECT t_status FROM tickets WHERE PNR= '$pnr'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
if($row==NULL) echo "<script type='text/javascript'>alert('PNR not found');</script>";
else echo "<script type='text/javascript'>alert('Your status is ' +'$row[t_status]');</script>";
}
if (isset($_POST['cancel']))
{
$pnr=$_POST['pnr'];
$sql = "DELETE FROM tickets WHERE PNR=$pnr;";
if(mysqli_query($conn, $sql))
echo "<script type='text/javascript'>alert('Your ticket has been cancelled');</script>";
else echo "<script type='text/javascript'>alert('Cancellation failed');</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PNR Status</title>
<LINK REL="STYLESHEET" HREF="STYLE.CSS">
<style type="text/css">
#pnr {
font-size: 20px;
background-color: white;
width: 500px;
height: 300px;
margin: auto;
border-radius: 25px;
border: 2px solid blue;
margin: auto;
position: absolute;
left: 0;
right: 0;
padding-top: 40px;
padding-bottom:20px;
margin-top: 130px;
}
html {
background: url(img/bg7.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#pnrtext {
padding-top: 20px;
}
</style>
</head>
<body>
<?php
include("header.php"); ?>
<center>
<div id="pnr">Check your PNR status here:<br/><br/>
<form method="post" name="pnrstatus" action="pnrstatus.php">
<div id="pnrtext"><input type="text" name="pnr" size="30" maxlength="10" placeholder="Enter PNR here"></div>
<br/><br/>
<input type="submit" name="submit" value="Check here!" class="button" id="submit"><br/><br/>
<?php
if(isset($_SESSION['user_info'])){
echo '<form action="pnrstatus.php" method="post"><input type="submit" class="button" value="Cancel your ticket!" name="cancel" id="cancel"/></form>';
}
else
echo '<A HREF="register.php">Login/Register</A>';
?>
</form>
</div>
</center>
</body>
</html>