<?php require_once 'Matchup.inc.php'; if (isset($_POST["submit"])) { MUDebug($_POST); $match = new MUMatch(); if ($match->createMatchesForFreeTournament($_POST["tournament_id"], $_POST["day"], $_POST["players"])) { $tournament = new MUTournaments(); $type = $tournament->getType($_POST["tournament_id"]); header("location: match.php?tournament=" . $_POST["tournament_id"] . "&tipo=" . $type); exit; } }
$types = new MUType(); // get all types $allTypes = $types->getAllTypes(); // if the submit button is pressed if (isset($_POST["submit"])) { // get all the values from the $_POST array $name = $_POST["name"]; $date = $_POST["date"]; $time = $_POST["time"]; $min_players = $_POST["min_players"]; $max_players = $_POST["max_players"]; $type = $_POST["type"]; // check if there are some empty values if (!empty($name) && !empty($date) && !empty($time) && !empty($min_players) && !empty($max_players) && !empty($type)) { // create an instanceof MUTournaments $tournament = new MUTournaments(); // format the time $time = date('H:i:s', strtotime($time)); // create the tournament if ($tournament->createTournament($_SESSION["username"], $name, $date, $time, $min_players, $max_players, $type)) { // redirect the user header("location: tournaments.php"); exit; } } } ?> <!DOCTYPE html> <html> <head> <title>Crea torneo</title>
echo "<tr><td class='td'>" . $allMatches[$i]["giornata"] . "</td>"; echo "<td class='td'>" . $allMatches[$i]["casa"] . "</td>"; echo "<td class='td'>" . $allMatches[$i]["trasferta"] . "</td>"; echo "<td class='td'><form method='POST'>"; echo "<input type='hidden' name='turno' value='" . $allMatches[$i]["giornata"] . "'/><input type='hidden' name='torneo_id' value='" . $allMatches[$i]["torneo"] . "'/><input type='hidden' name='match_id' value='" . $allMatches[$i]["ID"] . "'/><input type='text' placeholder='formato: 0-0' name='score' value='" . $allMatches[$i]["risultato"] . "'/></td>"; echo "<td class='td'><input type='submit' name='aggiorna' value='Aggiorna' /></form></td>"; echo "<td class='td'>" . $allMatches[$i]["vincitore"] . "</td></tr>"; } echo "</table>"; } } else { ?> <table class="table"> <?php $tournament = new MUTournaments(); $type = $tournament->getType($_GET["tournament"]); if ($type === "libero") { ?> <tr><td class='td'> Giornata </td><td class='td'> Casa </td><td class='td'> Risultato </td><td class='td'> Punti </td></tr> <?php $allMatches = $match->getAllMatchesFromFreeTournament($_GET["tournament"]); for ($i = 0; $i < count($allMatches); $i++) {
<?php /** * enroll.php * * Riccardo Crippa * therickys93@gmail.com * * this script register user to a tournament */ // require all the files require_once 'Matchup.inc.php'; require_once 'session.php'; // create an instanceof MUTournaments $tournaments = new MUTournaments(); // get all the tournament user is not register $allTournaments = $tournaments->getTournamentsUserIsNotEnrolledIn($_SESSION["username"]); // check if the submit button is pressed if (isset($_POST["submit"])) { // get the tournament id $tournament_id = $_POST["tournament_id"]; // create an instanceof MURegistration $registration = new MURegistration(); // register the user to the tournament if ($registration->registerUserToTournament($_SESSION["username"], $tournament_id)) { // redirect the user to the tournament header("location: tournaments.php"); exit; } } ?>
<body> <div class="header"> <div class="content_left"><b>MatchUp</b></div> <div class="content_right"> <ul> <li><a href="home.php">Profilo</a></li> <li><a href="tournaments.php">Torneo</a></li> <li><a href="logout.php">Esci</a></li> </ul> </div> <div class="clear"></div> </div> <div class="content"> I miei tornei <?php $tournaments = new MUTournaments(); if ($_SESSION["ruolo"] === "amministratore") { // show all the tournaments $results = $tournaments->getAllTournaments(); ?> <table class='table'> <tr><td class='td'> Nome </td><td class='td'> Edizione </td><td class='td'> Data </td><td class='td'> Ora </td><td class='td'> Tipo