mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-30 12:31:12 +02:00
Quelques vérifications temporelles et autres
This commit is contained in:
@ -2,13 +2,20 @@
|
||||
|
||||
include 'config.php';
|
||||
|
||||
if (!isset($_SESSION["team_id"]))
|
||||
error403();
|
||||
|
||||
if (isset($_POST["send_solution"])) {
|
||||
$error_message = saveSolution();
|
||||
}
|
||||
|
||||
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? GROUP BY `problem` ORDER BY `problem` ASC, `uploaded_at` DESC;");
|
||||
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
|
||||
$solutions_req->execute([$_SESSION["team_id"]]);
|
||||
|
||||
$tournament_req = $DB->prepare("SELECT `date_solutions` FROM `tournaments` WHERE `id` = ?;");
|
||||
$tournament_req->execute([$_SESSION["tournament_id"]]);
|
||||
$tournament_data = $tournament_req->fetch();
|
||||
|
||||
function saveSolution() {
|
||||
global $LOCAL_PATH, $DB;
|
||||
|
||||
@ -64,42 +71,44 @@ function saveSolution() {
|
||||
}
|
||||
}?>
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="problem">Problème :</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="problem" name="problem">
|
||||
<?php
|
||||
for ($i = 1; $i <= 9; ++$i) {
|
||||
echo "<option value=\"$i\">$i</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="file">Fichier :</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" id="file" name="solution" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input style="width: 100%;" type="submit" name="send_solution" value="Envoyer" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<?php if (date("yyyy-mm-dd") < $tournament_data["date_solutions"]) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="problem">Problème :</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="problem" name="problem">
|
||||
<?php
|
||||
for ($i = 1; $i <= 9; ++$i) {
|
||||
echo "<option value=\"$i\">$i</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="file">Fichier :</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" id="file" name="solution" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input style="width: 100%;" type="submit" name="send_solution" value="Envoyer" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<div style="padding: 20px"></div>
|
||||
<hr />
|
||||
|
||||
<h2>Solutions soumises :</h2>
|
||||
|
||||
|
Reference in New Issue
Block a user