Server IP : 149.202.105.228 / Your IP : 216.73.216.18 Web Server : Apache System : Linux webm129.cluster030.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : atfycaf ( 116275) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/atfycaf/www/admin/ |
Upload File : |
<?php $thisCheckID = 4; include "globalVars.php"; include "header.php"; ?> <h2>Create a New Knockout Tournament</h2> <?php if (isset($_POST["createTourney"])) { $tournType = cleanPost($_POST["tournType"], $conn); $tournTitle = cleanPost($_POST["tournTitle"], $conn); $tournStartDate = cleanPost($_POST["tournStartDate"], $conn); list($startDay, $startMonth, $startYear) = explode("/", $tournStartDate); $tournStartDate = $startYear ."-". $startMonth ."-". $startDay; $tournEndDate = cleanPost($_POST["tournEndDate"], $conn); list($endDay, $endMonth, $endYear) = explode("/", $tournEndDate); $tournEndDate = $endYear ."-". $endMonth ."-". $endDay; $tournLocation = cleanPost($_POST["tournLocation"], $conn); $tStartMonth = date("F", strtotime($tournStartDate)); if ($_POST["customRules"] == 1) { $additonalRules = $_POST["additionalRules"]; } else { $additonalRules = ""; } if (trim($tournTitle) == "") { $pageURL = $tournLocation; } else { $pageURL = $tournTitle; } $pageURL .= "-". $tStartMonth ."-". $startYear; $noCompetitors = cleanPost($_POST["noCompetitors"], $conn); if (isset($_POST["hasPreliminary"])) { $hasPrelims = 1; } else { $hasPrelims = 0; } if (isset($_POST["showScores"])) { $showScores = 1; } else { $showScores = 0; } $pageURL = str_replace($badURL, $goodURL, $pageURL); $pageURL = strtolower($pageURL) ; $dupQuery = mysqli_query($conn, "SELECT pageURL FROM knockoutConfig WHERE tournType = '$tournType' AND (pageURL LIKE '$pageURL%%')"); $isDup = mysqli_num_rows($dupQuery); if ($isDup > 0) { $pageURL .= "-". ($isDup + 1); } mysqli_query($conn, "INSERT INTO knockoutConfig (pageURL, tournType, tournTitle, tournStartDate, tournEndDate, tournLocation, noCompetitors, hasPrelims, showScores, customRules) VALUES ('$pageURL', '$tournType', '". addslashes($tournTitle) ."', '$tournStartDate', '$tournEndDate', '". addslashes($tournLocation) ."', '$noCompetitors', '$hasPrelims', '$showScores', '". addslashes($additonalRules) ."')"); $tournamentID = mysqli_insert_id($conn); $trackDate = date("Y-m-d H:i:s"); $tStartMonth = date("F", strtotime($tournStartDate)); $tStartYear = date("Y", strtotime($tournStartDate)); $trackTitle = "$tournLocation $tStartMonth $tStartYear"; mysqli_query($conn, "INSERT INTO userActions (dateCreated, adminID, pageTracking, databaseUpdated, updateDetails) VALUES ('$trackDate', '$adminID', 'admin/knockoutNew.html', 'knockoutConfig', 'The User ". addslashes($adminName) ." <$adminEmail> created the new knockout tournament ". addslashes($trackTitle) ." ')"); if (isset($_POST["playerNames"])) { $playersArray = $_POST["playerNames"]; $scoresArray = $_POST["playerScore"]; $matchDatesArray = $_POST["roundDate"]; foreach($playersArray as $round => $roundMatch) { foreach($roundMatch as $matchNo => $roundPlayers) { if ($matchNo == 9999) { // $roundDate = "0000-00-00 00:00:00"; } else { $roundDate = date("Y-m-d H:i:s", strtotime($matchDatesArray[$round][$matchNo][0])); } if ($matchNo != 9999) { if ( (isset($roundPlayers[0])) && (trim($roundPlayers[0]) != "") ) { $thisScore = $scoresArray[$round][$matchNo][0]; if (strtoupper($thisScore) == "W" || strtoupper($thisScore) == "WD") { $thisScore = 999999; } elseif (strtoupper($thisScore) == "B" || strtoupper($thisScore) == "BY" || strtoupper($thisScore) == "BYE") { $thisScore = 9999; } elseif ( ($thisScore == 0 || trim($thisScore) == "") && ($scoresArray[$round][$matchNo][1] == 0 || trim($scoresArray[$round][$matchNo][1]) == "") ) { $thisScore = -1; } mysqli_query($conn, "INSERT INTO knockoutRounds (tournID, roundID, roundDate, matchNo, participantName, matchScore) VALUES ('$tournamentID', '$round', '$roundDate', '$matchNo', '". addslashes($roundPlayers[0]) ."', '". $thisScore ."')"); } if ( (isset($roundPlayers[1])) && (trim($roundPlayers[1]) != "") ) { $thisAScore = $scoresArray[$round][$matchNo][1]; if (strtoupper($thisAScore) == "W" || strtoupper($thisAScore) == "WD") { $thisAScore = 999999; } elseif (strtoupper($thisAScore) == "B" || strtoupper($thisAScore) == "BY" || strtoupper($thisAScore) == "BYE") { $thisAScore = 9999; } elseif ( ($scoresArray[$round][$matchNo][0] == 0 || trim($scoresArray[$round][$matchNo][0]) == "") && ($thisAScore == 0 || trim($thisAScore) == "") ) { $thisScore = -1; } mysqli_query($conn, "INSERT INTO knockoutRounds (tournID, roundID, roundDate, matchNo, participantName, matchScore) VALUES ('$tournamentID', '$round', '$roundDate', '$matchNo', '". addslashes($roundPlayers[1]) ."', '". $thisAScore ."')"); } } else { ///// TIE NOT YET DRAWN \\\\\ foreach($roundPlayers as $undrawnPlayer) { mysqli_query($conn, "INSERT INTO knockoutRounds (tournID, roundID, roundDate, matchNo, participantName, matchScore) VALUES ('$tournamentID', '$round', '$roundDate', '0', '". addslashes($undrawnPlayer) ."', '-1')"); } } } } } include "xmlSitemap.php"; ?> <form action="knockoutEdit-2.html" method="post" id="leagueNext"> <input type="hidden" name="tournID" value="<?php echo $tournamentID ?>" /> <input type="hidden" name="finalised" value="true" /> </form> <script type="text/javascript"> document.getElementById('leagueNext').submit(); </script> <?php } else { ?> <form action="knockoutNew.html" method="post"> <div class="descStTab"> <div class="pFormRow"> <div class="pFormTitle">Knockout Group:</div> <div class="pFormSelect"> <select name="tournType" id="tournType" required> <option value="" selected disabled>Select</option> <?php $groupQuery = mysqli_query($conn, "SELECT * FROM knockoutGroups ORDER BY id ASC"); while ($gQ = mysqli_fetch_array($groupQuery)) { $groupID = $gQ["id"]; $groupName = $gQ["groupTitle"]; ?> <option value="<?php echo $groupID ?>"><?php echo $groupName ?></option> <?php } ?> </select> <div class="pFormLabel"> <label class="labelName">Knockout Group:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Tournament Start Date</div> <div class="pFormInput"> <input type="text" name="tournStartDate" id="tournStartDate" size="50" required /> <div class="pFormLabel"> <label class="labelName">Tournament Start Date:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Tournament Final Date</div> <div class="pFormInput"> <input type="text" name="tournEndDate" id="tournEndDate" size="50" required /> <div class="pFormLabel"> <label class="labelName">Tournament Final Date:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Tournament Name:</div> <div class="pFormInput"> <input type="text" name="tournTitle" size="50" /> <div class="pFormLabel"> <label class="labelName">Tournament Name:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Tournament Location:</div> <div class="pFormInput"> <input type="text" name="tournLocation" size="50" required /> <div class="pFormLabel"> <label class="labelName">Tournament Location:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Nº of Participants:</div> <div class="pFormInput"> <input type="number" name="noCompetitors" id="noCompetitors" min="2" step="1"> <div class="pFormLabel"> <label class="labelName">Nº of Participants:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Has Preliminary Rounds?:</div> <div class="pFormFilterInput"> <input type="checkbox" name="hasPreliminary" id="hasPreliminary" value="1"> <div class="pFormLabel"> <label class="labelName">Has Preliminary Rounds?:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Show Scores on the website?:</div> <div class="pFormFilterInput"> <input type="checkbox" name="showScores" value="1"> <div class="pFormLabel"> <label class="labelName">Show Scores on the website?:</label> </div> </div> </div> <div class="pFormRow"> <div class="pFormTitle">Custom Tournament Rules?:</div> <div class="pFormSelect"> <select name="customRules" id="customRules"> <option value="0">No, Standard tournament rules</option> <option value="1">Yes</option> </select> <div class="pFormLabel"> <label class="labelName">Custom Tournament Rules?:</label> </div> </div> </div> <div class="pFormRow" id="addRules"> <div class="pFormRow pFormTxtRow"> <div class="pFormTitle">Custom Rules:</div> <div id="additionalRules" class="tinyTxtEditor"></div> <div class="pFormLabel"> <label class="labelName">Custom Rules:</label> </div> </div> </div> </div> <div class="descStTab" id="competitorDisplay"> </div> <input type="submit" class="submitButton" id="createTourney" name="createTourney" value="Create this Tournament" disabled /> </form> <?php } ?> <?php include "footer.php"; ?>