-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDatView.php
More file actions
191 lines (157 loc) · 5.71 KB
/
DatView.php
File metadata and controls
191 lines (157 loc) · 5.71 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
<!--
Name: Matthew Williamson
CLID: MCW4553
Date: 4/29/2015
CoA: I certify this is entirely my work
-->
<?php
include "login.php";
if(isset($_SESSION["userType"]) == false)
{
echo "Not logged in!";
echo '<br><br>';
echo '<a href ="LoginPage.php">Go Log In</a>';
die();
}
?>
<html>
<head>
<title> datview </title>
<style>
hr {
display: block;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
}
</style>
</head>
<h1>Viewing History<hr></h1>
<body>
<?php
$sessionUser = $_SESSION['userType'];
$date = $_SESSION["today"];
$time = date('Y-m-d');
echo "Logged in as: <b> $sessionUser </b><br>";
echo "Member ID: <b>";
if($_SESSION['memberID'] == NULL)
echo("NULL");
else
echo($_SESSION['memberID']);
echo"</b> <br>";
echo "Today's date: <b>$date</b> <br>";
echo "<hr>";
?>
<?php
//is the memberSelection variable set from where this page is loaded from?
if (isset ($_POST['MemberSelection']))
{
$memberSelection = $_POST['MemberSelection'];
$accountSelection = $_POST['AccountSelection'];
echo("<h1>Viewing Account #$accountSelection</h1><hr>");
//print the memberSelection to see what we got
if($memberSelection == 'All')//view selection for whole account
{
/*
$seentItQuery =
"select
B.Name as User, C.Name, S.MovieID, M.Title, S.ShowTime
from
Member B, Movie M, Cinema C, Reservation R, MovieShowing S
where
C.ID = S.CinemaID
and R.MovieShowingID = S.ID
and S.MovieID = M.ID
and R.MemberID = B.ID
and R.MembershipID = '$accountSelection'
order by B.Name, M.Title";
*/
$seentItQuery =
"select
distinct B.Name as User, M.Title
from
Member B, Movie M, Cinema C, Reservation R, MovieShowing S
where
C.ID = S.CinemaID
and R.MovieShowingID = S.ID
and S.MovieID = M.ID
and R.MemberID = B.ID
and R.MembershipID = '$accountSelection'
order by B.Name, M.Title";
}
else //it's a specific user
{
/*
$seentItQuery = "select B.Name as User, C.Name, S.MovieID, M.Title, S.ShowTime
from Member B, Movie M, Cinema C, Reservation R, MovieShowing S
where C.ID = S.CinemaID
and R.MovieShowingID = S.ID
and S.MovieID = M.ID
and R.MemberID = B.ID
and R.MembershipID = '$accountSelection'
and B.Name = '$memberSelection'";
*/
$seentItQuery = "select distinct B.Name as User, M.Title
from Member B, Movie M, Cinema C, Reservation R, MovieShowing S
where C.ID = S.CinemaID
and R.MovieShowingID = S.ID
and S.MovieID = M.ID
and R.MemberID = B.ID
and R.MembershipID = '$accountSelection'
and B.Name = '$memberSelection'";
}
$seentItResult = mysql_query($seentItQuery) or die(mysql_error());
if(mysql_num_rows($seentItResult))
{
echo "<table border = \"1\" cellpadding = \"10\">";
echo "<caption align = 'left'> Displaying Information for: <b>$memberSelection</b> </caption>";
/* echo "<tr>
<th>Member</th>
<th>Cinema</th>
<th>Movie</th>
<th>Time</th>
</tr>";
*/
echo "<tr>
<th>Member</th>
<th>Movie</th>
</tr>";
while($row = mysql_fetch_array($seentItResult))
{
/*
echo "<tr>
<td>" . $row['User']. "</td>
<td>" . $row['Name']. "</td>
<td>" . $row['Title']. "</td>
<td>" . $row['ShowTime']. "</td>
</tr>";
*/
echo "<tr>
<td>" . $row['User']. "</td>
<td>" . $row['Title']. "</td>
</tr>";
}
echo "</table>";
echo"<br>";
}
else
{
if($memberSelection != "All")
echo("<h1>No viewing history available for $memberSelection</h1>");
else
echo("<h1>No viewing history available for Account #$accountSelection</h1>");
}
}
else
{
echo " something bad happened... the memberSelection variable was not set.... you should not be here";
}
?>
<form action = 'ViewingHistory.php'>
<input type ='submit' value = 'Go back to Viewing History Selection' align = 'left' >
</form>
</body>
</html>