echo "<td class='td'>"; echo "<input type='submit' name='free' value='Aggiorna' />"; echo "</form>"; echo "</td>"; echo "</tr>"; } echo "</table>"; ?> <table class="table"> <tr> <td class="td">Iscritti</td> <td class="td">Giornata</td> <td class="td">Azione</td> </tr> <?php $registration = new MURegistration(); $users = $registration->getUserNotApproved($_GET["tournament"]); echo "<form action='create_free_tournament.php' method='POST'>"; for ($i = 0; $i < count($users); $i++) { echo "<tr><td class='td'>"; echo "<input type='checkbox' name='players[]' value='" . $users[$i]["utente"] . "'/>" . $users[$i]["utente"]; if ($i == 0) { echo "</td>"; echo "<td class='td'>"; echo "<input type='hidden' name='tournament_id' value='" . $_GET["tournament"] . "' />"; echo "<input type='text' name='day' placeholder='giornata' />"; echo "</td><td class='td'>"; echo "<input type='submit' name='submit' value='Crea Gara' />"; echo "</td>"; } echo "</td></tr>";
* * 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; } } ?> <!DOCTYPE html> <html> <head> <title>Iscriviti al torneo</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body>
<?php /** * users.php * * Riccardo Crippa * therickys93@gmail.com * * this file display all the user enrolled in a tournament */ // require all the files require_once 'Matchup.inc.php'; require_once 'session.php'; // create an instanceof MURegistration $registration = new MURegistration(); // check if the submit button is pressed if (isset($_POST["submit"])) { // get all the values $username = $_POST["username"]; $tournament = $_POST["tournament"]; $price = $_POST["price"]; $award = $_POST["award"]; $approved = isset($_POST['approved']) && $_POST['approved'] ? "1" : "0"; // update all the values $registration->updateAll($username, $tournament, $price, $award, $approved); } // get all the users that are enrolled in the tournament $allUsers = $registration->getUsersEnrolledInTournament($_GET["tournament"]); ?> <!DOCTYPE html> <html>