<?php
/************************************************************************/
/* Jolt Roster Edit v1.0 */
/* =========================== */
/* */
/* Created by Oxi */
/* http://www.q4.jolt.co.uk */
/* */
/* Based on PHPNuke Feedback Module */
/* */
/* Modified by QuikShot */
/* http://www.jolt.co.uk */
/* */
/************************************************************************/
/* XNews theme */
$theme = "olive";
/* Background colour of table */
$bgcol = "#262A2B";
/* Who should the registration information be sent to? */
$adminemail = "imp@jolt.co.uk";
/* What is the name of the cup/league? */
$leaguename = "Jolt Q4.CTF League";
/* The XNews page ID of the information/rules section */
$rulesid = "15033";
/* Time and date at which signups close */
$signupsclose = "26th of Janurary 2007 (For Season 2)";
/* IRC channel for league/cup (including hash) */
$channel = "#q4.jolt";
/* The days, dates and times on which the league/cup will be played */
$plannedtimes = "from Feburary 2007 (Season 2)";
/* The URL of the subsite from which the league/cup is run */
$subsiteurl = "www.q4ctfl.jolt.co.uk";
/* Time/date at which those accepted into the league/cup are announced */
$announce = "First week of Feburary";
/* If you are expecting more than 100 signups, adjust this */
$maxsignups = 500;
/* That's all! */
/************************************************************************/
echo "<LINK REL=\"StyleSheet\" HREF=\"includes/style.css\" TYPE=\"text/css\">\n\n\n";
echo "<body style=\"font-family: Verdana; font-size: 8pt; color: #7BA6C6\" link=\"#668DDC\" vlink=\"#7D79DC\" alink=\"#668DDC\">\n\n\n";
$form_league= "<table width=\"460\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
<tr><td><img src=\"http://assets.jolt.co.uk/assets/steel/shim.gif\" width=\"460\" height=\"4\" border=\"0\"></TD></TR>
<tr><td class=\"contentboxhd\" height=\"18\" background=\"http://assets.jolt.co.uk/assets/steel/hdbg_newsbox.gif\">$leaguename Roster Editing
</TD></TR><TR><TD>
<center><br><b>Jolt Q4.CTF League Roster Editing Form</b><br><br>Please ensure that you are complying with the <a target=\"_blank\" href=\"index.php?page=&action=show&id=$rulesid\">rules</a> when making changes to your roster.<br>If you have any questions or problems, speak to the admins in #Q4.jolt (preferebly the Q4.CTFL Head Admin).<br><br>
</center>
<center><b>Fields marked with a * must be filled in. Enter the details you wish to change.</b></center>
<br><br></p><center>
<FORM METHOD=\"post\" ACTION=\"index.php?page=$page\">
<table border=\"0\">
<tr><td width=\"200\">* <b>Clan Tag</b></td>
<td><input type=text name=\"Clan Tag\" size=\"30\" maxlength=\"50\"></td></tr>
<tr><td>* <b>Full Clan Name<br></b></td>
<td><input type=text name=\"Clan Name\" size=\"30\" maxlength=\"50\"></td></tr>
<tr><td>* <b>Clan Players</b></td>
<td><textarea name=\"Clan Players\" rows=\"4\" cols=\"30\"></textarea></td></tr>
<tr><td> <b>Comments (anything else..)</b></td>
<td><textarea name=\"Clan Comments\" rows=\"4\" cols=\"30\"></textarea></td></tr>
<tr><td>* <i>I have entered Clan Tag, Clan Name and Players as a minimum.</i></td>
<td><INPUT TYPE=CHECKBOX NAME=\"Availability\"></td></tr>
<tr><td><br></td><td></td></tr>
<tr><td colspan=\"2\"><left>Note: You must tick the above box for the E-Mail to be sent.<br><br>
<blockquote> Please also note:
<ul><li>Implod will be recieving the E-Mail.<br>
<li>Any other method other than this form will not be acknowledged.<br>
<li>The rules with regards to changing your roster.<br>
<li>Our server settings.</ul></blockquote><br><br></left>
</td></tr>
<tr><td><br></td><td></td></tr></table>
<INPUT type=\"hidden\" name=\"opi\" value=\"ds\"
<p><input type=submit name=\"submit\" value=\"Send\"></p>
</form></center>
<br></td></tr><tr><td><table callpadding=\"5\" border=0><tr><td><br></td><td><br></td><td><br></td></tr></table>
<br><br></td></tr></table>";
if ($opi != "ds") {
echo "$form_league";
}
elseif ($opi =="ds") {
$channelnohash = str_replace("#", "", $channel);
$cip = getenv("REMOTE_ADDR");
$reg = str_replace(",", ".", $_POST);
$reg = preg_replace('/\n|\r|(\r\n)/m', ' | ', $reg);
$error_array = array();
while (list($key, $value) = each($reg)) {
// Search for empty fields
if ($value == "" && $key != "Clan_Website" && $key != "Past Seasons") {
array_push($error_array, $key);
$send = "no";
}
// Start building up email message
if ($key != "opi" && $key != "submit" && $key != "Availability") {
$msgdetails .= str_replace("_", " ", $key) . ": " . strip_tags($value) . "\n";
}
}
if (!$_POST['Availability']) {
array_push($error_array, "Availability");
$send = "no";
}
if ($send != "no") {
$filename = "signupdata/" . $rulesid . ".txt";
if (file_exists($filename)) {
$data = file($filename);
$count = count($data);
// Check for multiple signups from one IP
foreach($data as $dataline) {
if (eregi($cip, $dataline)) {
make1();
echo "<b>Signup failed</b><br><br>We have already received an E-Mail from you.<br><br>Please contact $adminemail for assistance";
make2();
$quitnow = "true";
}
}
} else {
$count = 0;
}
if ($count >= $maxsignups) {
make1();
echo "<b>Signup failed</b><br><br>This tournament is oversubscribed<br><br>Please contact $adminemail for assistance";
make2();
$quitnow = "true";
}
if (!$quitnow) {
reset($reg);
$data = fopen($filename, "a+");
fputs($data, $count+1 . "," . $cip . ",");
while (list($key, $value) = each($reg)) {
if ($key != "opi" && $key != "Availability" && $key != "submit") {
fputs($data, strip_tags($value) . ",");
}
}
fputs($data, "\n");
fclose($data);
$toaddress = $reg[""];
$msg = "Thank you for your application! This is an automated email confirming that we have received your signup and can reach you at the specified addresses. If your team's details change please let us know. You should receive a direct E-Mail from the League's Head Admin in the next 24 hours.\n\n";
$msg .= "Please join $channel on irc.quakenet.org so that we can contact you if needed.\n\n";
$msg .= "The details we have for your clan are as follows:\n\n";
$msg .= $msgdetails;
$msg .= "\nThe $leaguename Admin Team\n";
$msg .= "$subsiteurl\n\n";
$msg .= "--------------------------\n\n";
$msg .= "This registration was received from $cip - If this mail was not expected please contact $adminemail";
$to = "$toaddress";
$subject = "$leaguename - Registration received";
$replyto = "$adminemail";
$mailheaders = "From: $leaguename <$replyto> \n";
$mailheaders .= "Reply-To: $replyto\n";
$mailheaders .= "Bcc: $adminemail, kleeks@jolt.co.uk\n\n";
mail ($to, $subject, $msg, $mailheaders);
make1();
echo "<div align=\"center\">Your request to edit your roster on $leaguename has been submitted. You should receive email confirmation of this shortly.<br><br>
<i>If you do not receive an email within 48 hours please contact the Head Admin.</i><br><br>
<font color=\"#66FF33\">Please may you and your clan mates <b>join <a href=\"irc://irc.quakenet.org/$channelnohash\">$channel</a> on irc.quakenet.org</b><br>so that admins can contact you if needed (and to support the league).</font><br><br>
</div>";
make2();
}
} elseif ($send == "no") {
make1();
echo "We were unable to process your submission<br><br>";
echo "<b>Please click the back button on your browser and fill in the following fields:</b><br><br>";
while (list($key, $value) = each($error_array)) {
echo "<center>" . str_replace("_", " ", $value) . "</center><br>";
}
make2();
}
}
function make1 () {
global $theme, $leaguename, $bgcol;
echo "<table width=\"460\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
<tr><td><img src=\"http://assets.jolt.co.uk/assets/steel/shim.gif\" width=\"460\" height=\"4\" border=\"0\"></TD></TR>
<tr><td class=\"contentboxhd\" height=\"18\" background=\"http://assets.jolt.co.uk/assets/steel/hdbg_newsbox.gif\">$leaguename Signup
</TD></tR><TR><TD>";
}
function make2 () {
global $theme, $leaguename, $bgcol;
echo "<br><br><br><div align=\"center\"><img src=\"http://www.ut2004.jolt.co.uk/images/sep1.gif\"></img><br>
<img src=\"http://www.pczone.jolt.co.uk/blank.gif\" width=\"15\"></img><img src=\"http://www.ut2004.jolt.co.uk/images/jolt.gif\"></img></div></td>
</tr><tr><td><table callpadding=\"5\" border=0><tr><td><br></td><td><br></td><td><br></td></tr></table>
<br><br></td></tr></table>";
}
?>