-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventList.php
285 lines (251 loc) · 10.1 KB
/
eventList.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<?php
// eventList.php
/************************************************************************************
Copyright © 2008-2010 xhub.com
Sarah Bennert
sarah@xhub.com
This file is part of the Motorsports Online Event Registration System (MOERS).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Any system sensitive data such as IP addresses, usernames, and passwords
must be removed from all files before distribution.
************************************************************************************/
require_once 'include/config.php';
require_once 'include/functions.php';
require_once 'include/paypal.php';
require_once 'include/download.php';
function displayEvents($sqlArray)
{
require 'include/configGlobals.php';
echo "<script type=\"text/javascript\">\n";
echo "parent.main_disablePopupBackButton();\n";
echo "</script>\n";
// Display events
$eventcheck = mysql_query("SELECT * FROM events ORDER BY `events`.`eventDate`, `events`.`eventDB` ASC") or die(mysql_error());
echo "<table class=\"default\" width=\"100%\">\n";
echo "<th colspan=\"6\">Events</th>\n";
echo "<tr><td>Event Type</td><td>Event Name</td><td>Event Location</td><td>Event Date</td><td>Pre-registered</td><td>Pre-Registration</td></tr>\n";
while ($eventinfo = mysql_fetch_assoc( $eventcheck ))
{
$paymentStatus = "";
$today = date('Y-m-d');
if ($eventinfo['eventType'] == "Autocross")
{
if ($eventinfo['eventName'] == "All ".date('Y')." Autocross Regular Events")
{
$allAutoXEvents = 0x1;
$regBegin = date('Y-m-d', mktime(0,0,0,
substr($eventinfo['eventDate'], 5, 2),
substr($eventinfo['eventDate'],8,2)-90, // 3mo entry start
substr($eventinfo['eventDate'],0,4)));
}
else
{
$regBegin = date('Y-m-d', mktime(0,0,0,
substr($eventinfo['eventDate'], 5, 2),
substr($eventinfo['eventDate'],8,2)-30, // 1mo entry start
substr($eventinfo['eventDate'],0,4)));
}
$regCutoff = date('Y-m-d', mktime(0,0,0,
substr($eventinfo['eventDate'], 5, 2),
substr($eventinfo['eventDate'],8,2)-2, // 3 day cutoff
substr($eventinfo['eventDate'],0,4)));
}
else if ($eventinfo['eventType'] == "Hillclimb")
{
$regCutoff = date('Y-m-d', mktime(0,0,0,
substr($eventinfo['eventDate'], 5, 2),
substr($eventinfo['eventDate'],8,2)-7, // 7 day cutoff
substr($eventinfo['eventDate'],0,4)));
$regBegin = date('Y-m-d', mktime(0,0,0,
substr($eventinfo['eventDate'], 5, 2),
substr($eventinfo['eventDate'],8,2)-60, // 2mo entry start
substr($eventinfo['eventDate'],0,4)));
$regLateCutoff = date('Y-m-d', mktime(0,0,0,05,14,2008));
}
echo "<tr>\n";
echo "<td>".$eventinfo['eventType']."</td>";
echo "<td>".$eventinfo['eventName']."</td>";
echo "<td>".$eventinfo['eventLocation']."</td>";
echo "<td>".$eventinfo['eventDate']."</td>";
echo "<td>";
$tempquery = $eventinfo['eventDB'];
$tempEventcheck = mysql_query("SELECT * FROM $tempquery") or die(mysql_error());
$reg_count = 0;
$userRegistered = 0;
while ($tempEventInfo = mysql_fetch_assoc( $tempEventcheck ))
{
$reg_count = $reg_count + 1;
if ($tempEventInfo['registeredUser'] == $sqlArray['username'])
{
$userRegistered = 1;
}
}
if ($reg_count > 0)
{
if ($today <= $eventinfo['eventDate'])
{
echo "<form action=\"eventregistered.php\" method=\"POST\">\n";
echo "[ ".$reg_count." ] ";
echo "<input type=\"hidden\" name=\"regEventName\" value=\"".$eventinfo['eventDB']."\" />";
echo " <input type=\"submit\" name=\"showRegistration\" value=\"Show\" />\n";
if ($sqlArray['admin'] != 0)
{
echo "<input type=\"hidden\" name=\"regEventKey\" value=\"".$eventinfo['eventID']."\" />\n";
// echo "<br /><input type=\"submit\" name=\"downloadMember\" value=\"Download Member File\" />";
// echo "<br /><input type=\"submit\" name=\"downloadEntries\" value=\"Download Entries File\" />";
// echo "<br /><input type=\"submit\" name=\"downloadPrintable\" value=\"Download Printable File\" />";
echo "<br /><input type=\"submit\" name=\"downloadAllFiles\" value=\"Download All Files\" />\n";
}
echo "</form>\n";
}
else
{
echo "-";
}
}
else
{
echo "None";
}
echo "</td>\n";
echo "<td>\n";
echo "<table class=\"blank\"><tr><td>\n";
if (!isUserInfoComplete($sqlArray))
{
echo "User Info Incomplete\n";
echo "<form action=\"events.php\" method=\"POST\">\n";
}
else if ($userRegistered && ($today < $regCutoff))
{
$paymentStatus = displayPaypalEvent($sqlArray, $eventinfo);
echo "<form action=\"events.php\" method=\"POST\">\n";
}
elseif ($reg_count < 50)
{
echo "<form action=\"events.php\" method=\"POST\">\n";
if ($today < $regBegin)
{
echo "Not Open Yet \n";
}
else if ($today < $regCutoff)
{
if ($eventinfo['eventType'] != "Hillclimb" &&
$eventinfo['eventName'] != "4th Annual North Country Rumble" &&
$allAutoXEvents != 0x1)
{
echo "<input type=\"image\" src=\"images/classy-icons-set/png/32x32/folder_add.png\" name=\"register\" value=\"Register\" alt=\"Register\" title=\"Register For This Event\"onClick=\"alert('After registering for this event online you will still need to check-in with registration at the event.')\" />\n";
}
if($allAutoXEvents == 0x1)
{
echo "Not Available \n";
}
}
else
{
echo "Closed \n";
}
}
else
{
echo "Full \n";
}
echo "</td><td>\n";
echo "<input type=\"hidden\" name=\"regEventName\" value=\"".$eventinfo['eventDB']."\">\n";
if ($userRegistered && ($today >= $regBegin && $today < $regCutoff))
{
echo "<input type=\"image\" src=\"images/classy-icons-set/png/32x32/folder_edit.png\" name=\"editregistration\" value=\"EditRegistration\" alt=\"Edit Registration\" title=\"Edit Registration\" />\n";
}
if ($userRegistered && ($paymentStatus == "" ||
($paymentStatus != "Completed" &&
$paymentStatus != "Pending" &&
$paymentStatus != "Processed" &&
$paymentStatus != "In-Progress")))
{
// User is registered, but payment hasn't been completed. Allow them to unregister.
if (($today >= $regBegin) && ($today < $regCutoff))
{
echo "<input type=\"image\" src=\"images/classy-icons-set/png/32x32/folder_remove.png\" name=\"unregister\" value=\"Unregister\" alt=\"Unregister\" title=\"Unregister\" />\n";
}
}
else if ($eventinfo['eventType'] == "Autocross")
{
$allAutoXEvents |= 0x2;
}
echo "</td></tr></table>\n";
if ($eventinfo['eventType'] == "Hillclimb" &&
$today < $regCutoff && $today >= $regBegin)
{
if (isUserAdmin())
{
$itemName = $club_Abbr." ".$eventinfo['eventType']." ".$eventinfo['eventName']." ".$eventinfo['eventDate'];
$hashinput = $itemName . $sqlArray['username'];
$itemNumber = hash('md5', $hashinput);
echo "<a href=\"#\" onclick=\"parent.main_openPopupWindow('entryHillclimb.php?".$itemNumber."')\">Register (testing)</a>\n";
}
// echo "<a target=\"_blank\" href=\"http://www.hillclimb.org/events/ascutney/ascutney.htm\">Register</a>\n";
echo "<a target=\"_blank\" href=\"http://www.sccnh.org/hillclimbreg.html\">Register at sccnh.org</a>\n";
}
else if ($eventinfo['eventName'] == "4th Annual North Country Rumble")
{
echo "Rumble registration not fully completed<br>\n";
echo "Use <a target=\"_blank\" href=\"http://sccnh.xhub.com/SCCNH%20Rumble%20Registration%20Form%202008.pdf\">Official Entry Form [pdf]</a>\n";
echo "for now.\n";
}
echo "</td></form>\n";
echo "</tr>\n";
}
echo "</table>\n";
}
function displayAutoXInfo()
{
// Display Info
echo "<table class=\"default\" width=\"100%\">\n";
echo "<tr><th>AutoX Info:</th></tr>\n";
echo "<tr><td>\n";
echo file_get_contents("html/autoxinfo.html");
echo "</td></tr>\n";
echo "</table>\n";
}
function displayHillclimbInfo()
{
// Display Info
echo "<table class=\"default\" width=\"100%\">\n";
echo "<tr><th>Hillclimb Info:</th></tr>\n";
echo "<tr><td>\n";
echo file_get_contents("html/hillclimbinfo.html");
echo "</td></tr>\n";
echo "</table>\n";
}
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
////////////BEGIN SCRIPT EXECUTION BELOW//////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
if (!isSSL())
{
header("Location: logout.php");
}
else
{
validateSession();
$query = "SELECT * FROM users WHERE sha256_user = '".getCookie('ID')."'";
$check = mysql_query($query)or die(mysql_error());
$info = mysql_fetch_array($check);
echoFrameHeader();
// displayHillclimbInfo();
// displayAutoXInfo();
echo "<br /><br />";
displayEvents($info);
echoFrameFooter();
die(); // attempt to guard against any code insertion at the end of the file
}
?>