-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reservations.php
81 lines (60 loc) · 1.97 KB
/
Reservations.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(); ?>
<!DOCTYPE html>
<html lang="en">
<head >
<?php include("head.php"); ?>
<title>Reservations</title>
</head>
<body>
<?php include("navbar.php"); ?>
<table class="table">
<thead class="thead-inverse">
</thead>
<tbody>
<?php
$con=mysql_connect("localhost", "root", "");
if (!$con) {
die('could not connect: '.mysql_error());
}
mysql_select_db("opera", $con);
$q="SELECT * from reservation where cust='".$_SESSION['uname']."'";
$r1=mysql_query($q, $con);
if($r1)
{
while ($row1=mysql_fetch_array($r1))
{
$q="SELECT * from event where eid=".$row1['eno'];
$r=mysql_query($q, $con);
$row=mysql_fetch_array($r);
$pic = preg_replace('/\s+/', '_', $row[4]);
echo("<tr>");
echo(' <td width=360; rowspan ="4" colspan="" > <img src="EventImages\\'.$pic.'.jpg'.'"class="rounded " style="width:420px;height:260px;" > </td>');
echo('</tr>');
echo('<tr >') ;
echo('<td height=60 style="font-size:28px"><strong> <a style="color:#373a3c;" href="event.php?id='.$row[2].'">'.$row[2].' </a></strong></td>');
echo('</tr>');;
echo('<tr style="border-style:hidden;">') ;
echo('<td><strong> Reservation ID:</strong> <br>'.$row1['rid'].'</td>');
echo('</tr>');
echo('<tr>') ;
echo('<td> <strong>Date: </strong><br>'.$row[1].' at '.$row[6].'</td>');
$date1 = new DateTime($row[1]);
$date2 = new DateTime();
$diff = $date2->diff($date1)->format("%a");
if ($diff > 3)
{
echo '<td><a OnClick="javascript: return confirm(\'Are you sure you want to cancel the reservation?\');" style="float: right; margin-right: 20px;" class="btn btn-primary" href="Reservationsphp.php?rid='.$row1['rid'].'" role="button">Cancel Reservation</a></td>';
}
echo('</tr>');;
}
}
else
{
}
?>
</tbody>
</table>
<!-- FOOTER -->
<?php include("footer.php"); ?>
</body>
</html>