-
Notifications
You must be signed in to change notification settings - Fork 0
/
tab_locked.php
179 lines (169 loc) · 6.45 KB
/
tab_locked.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
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
<?php
if ($adminuserlevel == 'ADMINISTRATOR') {
//This checks to see if there is a page number. If not, it will set it to page 1
if (!(isset($pagenum)))
{
$pagenum = 1;
}
//Here we count the number of results
//Edit $data to be your query
if ($type == 'episode') {
$query = "SELECT * FROM tvepisodes WHERE locked='yes' ORDER BY id";
}
else if ($type == 'season') {
$query = "SELECT * FROM tvseasons WHERE locked='yes' ORDER BY id";
}
else {
$query = "SELECT * FROM games WHERE locked='yes' ORDER BY SeriesName";
$type = 'series';
}
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$rows = mysql_num_rows($result);
//This is the number of results displayed per page
$page_rows = 30;
//This tells us the page number of our last page
$last = ceil($rows/$page_rows);
//this makes sure the page number isn't below one, or more than our maximum pages
if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}
//This sets range that we will display in our query
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
?>
<div class="section">
<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center" style="font-size: 15px;">
<tr>
<td align="center" width="8%"> </td>
<td align="center">
<div class="titlesection">
<a href="/?tab=locked"><b>Series Lock Report</b></a>
</div>
</td>
<td align="center" width="5%"> </td>
<td align="center">
<div class="titlesection">
<a href="/?tab=locked&type=season"><b>Season Lock Report</b></a>
</div>
</td>
<td align="center" width="5%"> </td>
<td align="center">
<div class="titlesection">
<a href="/?tab=locked&type=episode"><b>Episode Lock Report</b></a>
</div>
</td>
<td align="center" width="8%"> </td>
</tr>
</table>
<h1>Locked Report | <?=$type?></h1>
<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center" id="listtable">
<?php
if ($type == 'episode') {
$query = "SELECT * FROM tvepisodes WHERE locked='yes' ORDER BY id $max";
print'<tr>
<td class="head">Series Name</td>
<td class="head">Season Number</td>
<td class="head">Episode Name</td>
<td class="head">Last Updated</td>
</tr>';
$result = mysql_query($query) or $error = 'No Episodes Are Locked';
}
else if ($type == 'season') {
$query = "SELECT * FROM tvseasons WHERE locked='yes' ORDER BY id $max";
print'<tr>
<td class="head">Series Name</td>
<td class="head">Season Number</td>
</tr>';
$result = mysql_query($query) or $error = 'No Seasons Are Locked';
}
else {
$query = "SELECT * FROM games WHERE locked='yes' ORDER BY SeriesName $max";
print'<tr>
<td class="head">ID</td>
<td class="head">Series Name</td>
<td class="head">Last Updated</td>
<td class="head">Disabled</td>
</tr>';
$result = mysql_query($query) or $error = 'No Series Are Locked';
}
while ($list = mysql_fetch_object($result)) {
if ($class == 'odd') { $class = 'even'; } else { $class = 'odd'; }
if ($type == 'episode') {
$query2 = "SELECT * FROM tvseasons WHERE id=$list->seasonid";
$result2 = mysql_query($query2) or die('Query failed: ' . mysql_error());
while ($seasons = mysql_fetch_object($result2)) {
$seriesid = $seasons->seriesid;
$seasonnumber = $seasons->season;
$query3 = "SELECT * FROM games WHERE id=$seriesid";
$result3 = mysql_query($query3) or die('Query failed: ' . mysql_error());
while ($series = mysql_fetch_object($result3)) {
$Seriesname = $series->SeriesName;
}
}
$lastupdated = date("r", $list->lastupdated);
print "<tr><td class=\"$class\"><a href=\"/?tab=series&id=$seriesid\">$Seriesname</a></td><td class=\"$class\"><a href=\"/?tab=season&seriesid=$seriesid&seasonid=$list->seasonid\">$seasonnumber</a></td><td class=\"$class\"><a href=\"/?tab=episode&seriesid=$seriesid&seasonid=$list->seasonid&id=$list->id\">$list->EpisodeName</a></td><td class=\"$class\">$lastupdated</td></tr>\n";
}
else if ($type == 'season') {
$query2 = "SELECT * FROM games WHERE id=$list->seriesid";
$result2 = mysql_query($query2) or die('Query failed: ' . mysql_error());
while ($series = mysql_fetch_object($result2)) {
$Seriesname = $series->SeriesName;
}
print "<tr><td class=\"$class\"><a href=\"/?tab=series&id=$list->seriesid\">$Seriesname</a></td><td class=\"$class\"><a href=\"/?tab=season&seriesid=$list->seriesid&seasonid=$list->id\">$list->season</a></td></tr>\n";
}
else {
$lastupdated = date("r", $list->lastupdated);
print "<tr><td class=\"$class\">$list->id</td><td width=\"400\" class=\"$class\"><a href=\"/?tab=series&id=$list->id\">$list->SeriesName</a></td><td class=\"$class\">$lastupdated</td><td class=\"$class\">";
if ($list->disabled) {
print "<img src=\"/images/checkmark.png\" width=10 height=10>";
}
print "</td></tr>\n";
}
}
if ($error) {
print "<tr><td>$error</td></tr>";
}
?>
</table>
</div>
<?php
echo "<div class=\"section\">";
echo '<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">';
echo '<tr><td>';
// This shows the user what page they are on, and the total number of pages
echo " --Page $pagenum of $last-- </td>";
echo "<td align='right'>";
// First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page.
if ($pagenum == 1)
{}
else {
echo " <a href='$fullurl&pagenum=1'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='$fullurl&pagenum=$previous'> <-Previous</a> ";
}
//just a spacer
echo " ---- ";
//This does the same as above, only checking if we are on the last page, and then generating the Next and Last links
if ($pagenum == $last)
{}
else {
$next = $pagenum+1;
echo " <a href='$fullurl&pagenum=$next'>Next -></a> ";
echo " ";
echo " <a href='$fullurl&pagenum=$last'>Last ->></a> ";
}
echo "</td></tr></table>";
} //
else {
?>
<div class="section">
<h1>Administrators Only</h1>
</div>
<?php
}
?>