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 include "globalVars.php"; if (isset($_POST["tT"])) { $tournType = $_POST["tT"]; $groupRulesQuery = mysqli_query($conn, "SELECT groupRules FROM knockoutGroups WHERE id = '$tournType'"); while ($gRQ = mysqli_fetch_array($groupRulesQuery)) { $groupRules = $gRQ["groupRules"]; } echo $groupRules; } elseif (isset($_POST["nC"])) { $noCompetitors = $_POST["nC"]; $hasPrelims = $_POST["hP"]; if (isset($_POST["playerNames"])) { $playerNames = $_POST["playerNames"]; if (isset($_POST["playerScore"])) { $playerScores = $_POST["playerScore"]; } else { $playerScores = array(); } if (isset($_POST["roundDate"])) { $roundDates = $_POST["roundDate"]; } else { $roundDates = array(); } } else { $playerNames = array(); $playerScores = array(); $roundDates = array(); } $htmlTemplate = "knockout-"; $fixturesCSS = "knockout"; if ($hasPrelims == 1) { $htmlTemplate .= "pre-"; $fixturesCSS .= "Pre"; } if ($noCompetitors <= 4) { $htmlTemplate .= "4"; $fixturesCSS .= "4"; if ($hasPrelims == 1) { $roundsArray = array(0 => 2, 1 => 2, 2 => 1); } else { $roundsArray = array(1 => 2, 2 => 1); } } elseif ($noCompetitors <= 8) { $htmlTemplate .= "8"; $fixturesCSS .= "8"; if ($hasPrelims == 1) { $roundsArray = array(0 => 4, 1 => 4, 2 => 2, 3 => 1); } else { $roundsArray = array(1 => 4, 2 => 2, 3 => 1); } } elseif ($noCompetitors <= 16) { $htmlTemplate .= "16"; $fixturesCSS .= "16"; if ($hasPrelims == 1) { $roundsArray = array(0 => 8, 1 => 8, 2 => 4, 3 => 2, 4 => 1); } else { $roundsArray = array(1 => 8, 2 => 4, 3 => 2, 4 => 1); } } elseif ($noCompetitors <= 32) { $htmlTemplate .= "32"; $fixturesCSS .= "32"; if ($hasPrelims == 1) { $roundsArray = array(0 => 16, 1 => 16, 2 => 8, 3 => 4, 4 => 2, 5 => 1); } else { $roundsArray = array(1 => 16, 2 => 8, 3 => 4, 4 => 2, 5 => 1); } } elseif ($noCompetitors <= 64) { $htmlTemplate .= "64"; $fixturesCSS .= "64"; if ($hasPrelims == 1) { $roundsArray = array(0 => 32, 1 => 32, 2 => 16, 3 => 8, 4 => 4, 5 => 2, 6 => 1); } else { $roundsArray = array(1 => 32, 2 => 16, 3 => 8, 4 => 4, 5 => 2, 6 => 1); } } $rawTemplate = file_get_contents($SERVER_ROOT ."/". $htmlTemplate .".html"); foreach($roundsArray as $roundID => $noMatches) { for ($m = 1; $m <= $noMatches; $m++) { $replaceTD = "[[ROUND_". $roundID ."_". $m ."]]"; if (isset($playerNames[$roundID][$m][0])) { $playerName = $playerNames[$roundID][$m][0]; $playerScore = $playerScores[$roundID][$m][0]; } else { $playerName = ""; $playerScore = ""; } if (isset($playerNames[$roundID][$m][1])) { $opponentName = $playerNames[$roundID][$m][1]; $opponentScore = $playerScores[$roundID][$m][1]; } else { $opponentName = ""; $opponentScore = ""; } if (isset($roundDates[$roundID][$m][0])) { $roundDate = $roundDates[$roundID][$m][0]; } else { $roundDate = ""; } $matchReplace = '<span class="fixtureDateTime"><label>Date:</label><input type="datetime-local" class="roundDate" name="roundDate['. $roundID .']['. $m .'][]" value="'. $roundDate .'"></span> <input type="text" id="player_'. $roundID .'_'. $m .'_1" class="playerName" name="playerNames['. $roundID .']['. $m .'][]" size="50" placeholder="Player Name" value="'. $playerName .'" /> <input type="text" class="scoreInput" name="playerScore['. $roundID .']['. $m .'][]" size="50" placeholder="Score" data-m="'. $m .'" data-r="'. $roundID .'" value="'. $playerScore .'" /> <input type="text" id="player_'. $roundID .'_'. $m .'_2" class="playerName" name="playerNames['. $roundID .']['. $m .'][]" size="50" placeholder="Player Name" value="'. $opponentName .'" /> <input type="text" class="scoreInput" name="playerScore['. $roundID .']['. $m .'][]" size="50" placeholder="Score" data-m="'. $m .'" data-r="'. $roundID .'" value="'. $opponentScore .'" />'; $rawTemplate = str_replace($replaceTD, $matchReplace, $rawTemplate); } } echo $rawTemplate; /* $compLeft = $noCompetitors; $noRounds = getNoRounds($compLeft); ?> <div id="roundSelect"> <?php $noMatches = 1; $matchesArray = array(); if ($hasPrelims == 1) { ?> <a id="round0" class="selectedRound">Preliminary Round</a> <?php } for ($thisRound = 1; $thisRound <= $noRounds; $thisRound++) { $noMatches = $noMatches * 2; $matchesArray[] = $noMatches; $final = $noRounds; $semiFinal = $noRounds - 1; $qtrFinal = $noRounds - 2; if ($thisRound == $final) { $roundTitle = "Final"; } elseif ($thisRound == $semiFinal) { $roundTitle = "Semi-Finals"; } elseif ($thisRound == $qtrFinal) { $roundTitle = "Quarter-Finals"; } else { $roundTitle = "Round $thisRound"; } ?> <a id="round<?php echo $thisRound ?>"<?php if ( ($thisRound == 1) && ($hasPrelims == 0) ) {?> class="selectedRound"<?php } ?>><?php echo $roundTitle ?></a> <?php } $matchesArrayR = array_reverse($matchesArray); $matchesArrayC = 0; ?> </div> <?php ?> <div id="roundDisplay"> <?php if ($hasPrelims == 1) { if (isset($_POST["sP"])) { $nI = 1; $shPlayersArray = array(); foreach($playerNames[0] as $players) { foreach($players as $player) { $shPlayersArray[$nI] = $player; $nI++; } } shuffle($shPlayersArray); $playerNames[0] = $shPlayersArray; } ?> <div class="roundDisplay selectedRoundDisplay" id="round0Display"> <h3>Preliminary Round</h3> <p>If a player receives a bye for this round place them in a match on their own and enter their score as <strong>B</strong> to forward them to the first round. If a player withdraws set their score as <strong>WD</strong> <a id="shufflePlayers">Randomise Draw</a></p> <div class="listTitle listTitleW">Round Draw</div> <div class="roundDateInp">Date: <input type="text" name="roundDate[0]" class="roundDate" size="50" /></div> <div class="fixturesListC"> <ul id="fixtures0" class="fixtureSet ui-sortable" data-fc="<?php echo $noCompetitors ?>"> <?php $matchNo = 1; $player = 0; for ($m = 1; $m <= $matchesArrayR[0]; $m++) { if (isset($_POST["sP"])) { $spM = $m - 1; $playerName = $playerNames[0][$spM]; $playerScore = ""; } elseif (isset($playerNames[0][$matchNo][$player])) { $playerName = $playerNames[0][$matchNo][$player]; $playerScore = $playerScores[0][$matchNo][$player]; } else { $playerName = ""; $playerScore = ""; } ?> <li data-m="<?php echo $matchNo ?>" data-r="0"><i class="fas fa-grip-horizontal"></i><input type="text" id="player_0_<?php echo $m ?>" class="playerName" name="playerNames[0][<?php echo $matchNo ?>][]" size="50" placeholder="Player Name" value="<?php echo $playerName ?>" /> <input type="text" class="scoreInputPre" name="playerScore[0][<?php echo $matchNo ?>][]" size="50" placeholder="Score" data-m="<?php echo $matchNo ?>" data-r="0" value="<?php echo $playerScore ?>" /><?php if ($m % 2 == 0) { } else { ?><span class="fixtureDateTime"><label>Date:</label><input type="datetime-local" name="roundDate[<?php echo $thisRound ?>][<?php echo $matchNo ?>][]"></span><?php } ?></li> <?php if ($m % 2 == 0) { $matchNo++; $player = 0; } else { $player++; } } ?> </ul> </div> </div> <?php } for ($thisRound = 1; $thisRound <= $noRounds; $thisRound++) { $final = $noRounds; $semiFinal = $noRounds - 1; $qtrFinal = $noRounds - 2; if ($thisRound == $final) { $roundTitle = "Final"; } elseif ($thisRound == $semiFinal) { $roundTitle = "Semi-Finals"; } elseif ($thisRound == $qtrFinal) { $roundTitle = "Quarter-Finals"; } else { $roundTitle = "Round $thisRound"; } $noPlayers = $matchesArrayR[$matchesArrayC]; $noMatches = $noPlayers / 2; ?> <div class="roundDisplay<?php if ( ($thisRound == 1) && ($hasPrelims == 0) ) {?> selectedRoundDisplay<?php } ?>" id="round<?php echo $thisRound ?>Display"> <h3><?php echo $roundTitle ?></h3> <?php if ($thisRound != $final) { ?> <p>If a player receives a bye for this round place them in a match on their own and enter their score as <strong>B</strong> to forward them to the next round. If a player withdraws set their score as <strong>WD</strong><?php if ($thisRound == 1) {?><a id="shufflePlayers">Randomise Draw</a><?php } ?></p> <?php } if ($thisRound != 1) { ?> <div class="listTitle">Players</div> <?php } ?> <div class="listTitle listTitleW">Round Draw</div> <?php if ($thisRound != 1) { ?> <div class="playersListC"> <ul id="players<?php echo $thisRound ?>" class="playersSet ui-sortable"> </ul> </div> <?php } ?> <div class="fixturesListC"> <ul id="fixtures<?php echo $thisRound ?>" class="fixtureSet ui-sortable" data-fc="<?php echo $noPlayers ?>"> <?php $matchNo = 1; $player = 0; if (isset($_POST["sP"])) { if ($thisRound == 1) { $nI = 1; $shPlayersArray = array(); foreach($playerNames[1] as $players) { foreach($players as $player) { $shPlayersArray[$nI] = $player; $nI++; } } shuffle($shPlayersArray); $playerNames[1] = $shPlayersArray; } } for ($m = 1; $m <= $noPlayers; $m++) { if ($thisRound == 1) { if (isset($_POST["sP"])) { $spM = $m - 1; $playerName = $playerNames[1][$spM]; $playerScore = ""; } elseif (isset($playerNames[1][$matchNo][$player])) { $playerName = $playerNames[1][$matchNo][$player]; $playerScore = $playerScores[1][$matchNo][$player]; } else { $playerName = ""; $playerScore = ""; } ?> <li data-m="<?php echo $matchNo ?>" data-r="<?php echo $thisRound ?>"><i class="fas fa-grip-horizontal"></i><input type="text" id="player_1_<?php echo $m ?>" class="playerName" name="playerNames[<?php echo $thisRound ?>][<?php echo $matchNo ?>][]" size="50" placeholder="Player Name" value="<?php echo $playerName ?>" /> <input type="text" class="scoreInput" name="playerScore[<?php echo $thisRound ?>][<?php echo $matchNo ?>][]" size="50" placeholder="Score" data-m="<?php echo $matchNo ?>" data-r="<?php echo $thisRound ?>" value="<?php echo $playerScore ?>" /><?php if ($m % 2 == 0) { } else { ?><span class="fixtureDateTime"><label>Date:</label><input type="datetime-local" name="roundDate[<?php echo $thisRound ?>][<?php echo $matchNo ?>][]"></span><?php } ?></li> <?php } else { ?> <li class="ui-sortable-placeholder" data-m="<?php echo $matchNo ?>" data-r="<?php echo $thisRound ?>"></li> <?php } if ($m % 2 == 0) { $matchNo++; $player = 0; } else { $player++; } } ?> </ul> </div> </div> <?php $matchesArrayC++; } ?> </div> <?php */ } ?>