This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
blocks.php
200 lines (159 loc) · 7.1 KB
/
blocks.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?
if(!defined("CONFIG")) exit();
if(!isset($login)) { show_error("You do not have administrator rights\n"); return; }
require_once("session_start.php");
require_once("functions.php"); // import mysql function
$link = mysqlconnect(); // call mysql function to get the link to the database
?>
<!--Next events-->
<h1>Next events</h1>
<?
$query_next_status = "SELECT active FROM blocks WHERE content_file='next_events'";
$result_next_status = mysqli_query($link,$query_next_status);
mysqli_free_result($result_next_status);
$active_next = $_POST["active_next"];
if (isset($_POST['active_next'])) {
$query_next = "UPDATE blocks SET active='$active_next' WHERE content_file='next_events'";
$result_next = mysqli_query($link,$query_next);
if (!$result_next) error("MySQL Error: ".mysqli_error($link)."\n");
echo "<br /> <strong><h2>Next events succesfully modified</h2></strong>";
}else{
?>
<form action=".?page=blocks" method="post">
Activate:
<input type="radio" name="active_next" <?php if (isset($result_next_status) && $result_next_status=="1") echo "checked";?> value="1">Yes
<input type="radio" name="active_next" <?php if (isset($result_next_status) && $result_next_status=="0") echo "checked";?> value="0">No
</b> </b> <input type="submit" name="submit" value="Set">
<br><br>
</form>
<? } ?>
<!--Last race block-->
<h1>Last race</h1>
<?
$query_last_status = "SELECT active FROM blocks WHERE content_file='last_race'";
$result_last_status = mysqli_query($link,$query_last_status);
mysqli_free_result($result_last_status);
$active_last = $_POST["active_last"];
if (isset($_POST['active_last'])) {
$query_last = "UPDATE blocks SET active='$active_last' WHERE content_file='last_race'";
$result_last = mysqli_query($link,$query_last);
if (!$result_last) error("MySQL Error: ".mysqli_error($link)."\n");
echo "<br /> <strong><h2>Last_race succesfully modified</h2></strong>";
}else{ ?>
<form action=".?page=blocks" method="post">
Activate:
<input type="radio" name="active_last" <?php if (isset($result_last_status) && $result_last_status=="1") echo "checked";?> value="1">Yes
<input type="radio" name="active_last" <?php if (isset($result_last_status) && $result_last_status=="0") echo "checked";?> value="0">No
</b> </b> <input type="submit" name="submit" value="Set">
<br><br>
</form>
<? } ?>
<!--comms_viewer-->
<h1>Comms viewer</h1>
<?
$query_comms_status = "SELECT active FROM blocks WHERE content_file='comms_viewer'";
$result_comms_status = mysqli_query($link,$query_comms_status);
mysqli_free_result($result_comms_status);
$active_comms = $_POST["active_comms"];
if (isset($_POST['active_comms'])) {
$query_comms = "UPDATE blocks SET active='$active_comms' WHERE content_file='comms_viewer'";
$result_comms = mysqli_query($link,$query_comms);
if (!$result_comms) error("MySQL Error: ".mysqli_error($link)."\n");
echo "<br /> <strong><h2>Comms viewer succesfully modified</h2></strong>";
}else{ ?>
<form action=".?page=blocks" method="post">
Activate:
<input type="radio" name="active_comms" <?php if (isset($result_comms_status) && $result_comms_status=="1") echo "checked";?> value="1">Yes
<input type="radio" name="active_comms" <?php if (isset($result_comms_status) && $result_comms_status=="0") echo "checked";?> value="0">No
</b> </b> <input type="submit" name="submit" value="Set">
<br><br>
</form>
<? } ?>
<!--streaming block-->
<h1>Streaming viewer block</h1>
<?
$query_streaming_status = "SELECT active FROM blocks WHERE content_file='streaming'";
$result_streaming_status = mysqli_query($link,$query_streaming_status);
mysqli_free_result($result_streaming_status);
$active_streaming = $_POST["active_streaming"];
if (isset($_POST['active_streaming'])) {
$query_streaming = "UPDATE blocks SET active='$active_streaming' WHERE content_file='streaming'";
$result_streaming = mysqli_query($link,$query_streaming);
if (!$result_streaming) error("MySQL Error: ".mysqli_error($link)."\n");
echo "<br /> <strong><h2>Streaming block succesfully modified</h2></strong>";
}else{ ?>
<form action=".?page=blocks" method="post">
Activate:
<input type="radio" name="active_streaming" <?php if (isset($result_streaming_status) && $result_streaming_status=="1") echo "checked";?> value="1">Yes
<input type="radio" name="active_streaming" <?php if (isset($result_streaming_status) && $result_streaming_status=="0") echo "checked";?> value="0">No
</b> </b> <input type="submit" name="submit" value="Set">
<br><br>
</form>
<? } ?>
<!--standings block-->
<h1>Standings block</h1>
<?
$query_standings_status = "SELECT active FROM blocks WHERE content_file='standings'";
$result_standings_status = mysqli_query($link,$query_standings_status);
mysqli_free_result($result_standings_status);
$active_standings = $_POST["active_standings"];
if (isset($_POST['active_standings'])) {
$query_standings = "UPDATE blocks SET active='$active_standings' WHERE content_file='standings'";
$result_standings = mysqli_query($link,$query_standings);
if (!$result_standings) error("MySQL Error: ".mysqli_error($link)."\n");
echo "<br /> <strong><h2>Standings succesfully modified</h2></strong>";
}else{ ?>
<form action=".?page=blocks" method="post">
Activate:
<input type="radio" name="active_standings" <?php if (isset($result_standings_status) && $result_standings_status=="1") echo "checked";?> value="1">Yes
<input type="radio" name="active_standings" <?php if (isset($result_standings_status) && $result_standings_status=="0") echo "checked";?> value="0">No
</b> </b> <input type="submit" name="submit" value="Set">
<br><br>
</form>
<? } ?>
<!--Standing_block_pages-->
<?
$sql_sp_list = "SELECT sp.*, s.name FROM standing_pages sp JOIN season s ON (sp.season = s.id) ORDER BY sp.page ASC";
$result_sp_list = mysqli_query($link,$sql_sp_list);
if(!$result_sp_list) {
show_error("MySQL error: " . mysqli_error($link));
return;
}
?>
<br />
<br />
<a href=".?page=standings_add">Add Standing page</a>
<?
if(mysqli_num_rows($result_sp_list) == 0) {
show_msg("No standings pages found\n");
return;
}
?>
<div class="w3-container">
<table class="w3-table-all">
<tr class="w3-dark-grey">
<td> </td>
<td>Page</td>
<td>Season</td>
</tr>
<?
while($item = mysqli_fetch_array($result_sp_list)) {
?>
<tr class="w3-hover-green">
<td>
<a href=".?page=standings_chg&id=<?=$item['id']?>"><img src="images/edit16.png" alt="chg"></a>
<a href=".?page=standings_rem&id=<?=$item['id']?>"><img src="images/delete16.png" alt="rem"></a>
</td>
<td><?=$item['page']?></td>
<td><?=$item['name']?></td>
</tr>
<?
}
mysqli_free_result($result_sp_list)
?>
</table>