-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/server_files/informations.php b/server_files/informations.php
index d80d70b..d32a7f2 100644
--- a/server_files/informations.php
+++ b/server_files/informations.php
@@ -1,16 +1,16 @@
query("SELECT * FROM `users` WHERE `id` = $id;")->fetch();
if ($user_data === false) {
- include "404.php";
+ require_once "404.php";
}
$team_data = false;
@@ -22,7 +22,7 @@ $tournaments_req = $DB->query("SELECT `tournament`, `name` FROM `organizers` JOI
?>
-
+
@@ -93,4 +93,4 @@ elseif ($user_data["role"] == "PARTICIPANT" || $user_data["role"] == "ENCADRANT"
}
} ?>
-
+
diff --git a/server_files/inscription.php b/server_files/inscription.php
index 7e23a59..751b20d 100644
--- a/server_files/inscription.php
+++ b/server_files/inscription.php
@@ -1,6 +1,6 @@
-
+
Erreur : " . $error_message . ""; ?>
@@ -276,6 +276,6 @@ function register() {
selectRole();
-
+
diff --git a/server_files/mon_compte.php b/server_files/mon_compte.php
index 35b5e0f..1c19358 100644
--- a/server_files/mon_compte.php
+++ b/server_files/mon_compte.php
@@ -1,323 +1,323 @@
-query("SELECT * FROM `users` WHERE `id` = '" . $_SESSION["user_id"] . "';");
- $user_data = $result->fetch();
-}
-
-function updateAccount()
-{
- global $DB, $URL_BASE, $MAIL_ADDRESS;
-
- if (!isset($_SESSION["user_id"]))
- return "Vous n'êtes pas connecté.";
-
- $ID = $_SESSION["user_id"];
-
- $surname = htmlspecialchars($_POST["surname"]);
- if (isset($surname) && $surname != "")
- $DB->prepare("UPDATE `users` SET `surname` = ? WHERE `id` = ?;")->execute([$surname, $ID]);
-
- $first_name = htmlspecialchars($_POST["firstname"]);
- if (isset($first_name) && $first_name != "")
- $DB->prepare("UPDATE `users` SET `first_name` = ? WHERE `id` = ?;")->execute([$first_name, $ID]);
-
- $birth_date = htmlspecialchars($_POST["birth_date"]);
- if (isset($birth_date) && $birth_date != "")
- $DB->prepare("UPDATE `users` SET `birth_date` = ? WHERE `id` = ?;")->execute([$birth_date, $ID]);
-
- if (isset($_POST["gender"])) {
- $gender = htmlspecialchars($_POST["gender"]);
- if (isset($gender) && ($gender == "M" || $gender == "F"))
- $DB->prepare("UPDATE `users` SET `gender` = ? WHERE `id` = ?;")->execute([$gender, $ID]);
- }
-
- $address = htmlspecialchars($_POST["address"]);
- if (isset($address) && $address != "")
- $DB->prepare("UPDATE `users` SET `address` = ? WHERE `id` = ?;")->execute([$address, $ID]);
-
- $postal_code = htmlspecialchars($_POST["postal_code"]);
- if (isset($postal_code) && $postal_code != "")
- $DB->prepare("UPDATE `users` SET `postal_code` = ? WHERE `id` = ?;")->execute([$postal_code, $ID]);
-
- $city = htmlspecialchars($_POST["city"]);
- if (isset($city) && $city != "")
- $DB->prepare("UPDATE `users` SET `city` = ? WHERE `id` = ?;")->execute([$city, $ID]);
-
- $country = htmlspecialchars($_POST["country"]);
- if (isset($country) && $country != "")
- $DB->prepare("UPDATE `users` SET `country` = ? WHERE `id` = ?;")->execute([$country, $ID]);
-
- $phone_number = htmlspecialchars($_POST["phone_number"]);
- if (isset($phone_number) && $phone_number != "")
- $DB->prepare("UPDATE `users` SET `phone_number` = ? WHERE `id` = ?;")->execute([$phone_number, $ID]);
-
- if (isset($_POST["school"])) {
- $school = htmlspecialchars($_POST["school"]);
- if (isset($school) && $school != "")
- $DB->prepare("UPDATE `users` SET `school` = ? WHERE `id` = ?;")->execute([$school, $ID]);
- }
-
- if (isset($_POST["class"])) {
- $class = htmlspecialchars($_POST["class"]);
- if (isset($class) && ($class == "terminale" || $class == "premiere" || $class == "seconde"))
- $DB->prepare("UPDATE `users` SET `class` = ? WHERE `id` = ?;")->execute([strtoupper($class), $ID]);
- }
-
- if (isset($_POST["responsible_name"])) {
- $responsible_name = htmlspecialchars($_POST["responsible_name"]);
- if (isset($responsible_name) && $responsible_name != "")
- $DB->prepare("UPDATE `users` SET `responsible_name` = ? WHERE `id` = ?;")->execute([$responsible_name, $ID]);
- }
-
- if (isset($_POST["responsible_phone"])) {
- $responsible_phone = htmlspecialchars($_POST["responsible_phone"]);
- if (isset($responsible_phone) && $responsible_phone != "")
- $DB->prepare("UPDATE `users` SET `responsible_phone` = ? WHERE `id` = ?;")->execute([$responsible_phone, $ID]);
- }
-
- if (isset($_POST["responsible_email"])) {
- $responsible_email = htmlspecialchars($_POST["responsible_email"]);
- if (isset($responsible_email) && $responsible_email != "")
- $DB->prepare("UPDATE `users` SET `responsible_email` = ? WHERE `id` = ?;")->execute([$responsible_email, $ID]);
- }
-
- if (isset($_POST["description"])) {
- $description = htmlspecialchars($_POST["description"]);
- if (isset($description) && $description != "")
- $DB->prepare("UPDATE `users` SET `description` = ? WHERE `id` = ?;")->execute([$description, $ID]);
- }
-
- $email = htmlspecialchars($_POST["email"]);
- if (isset($email) && $email != "" && filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $confirm_email_uid = uniqid();
- $DB->prepare("UPDATE `users` SET `email` = ?, `confirm_email` = ? WHERE `id` = ?;")->execute([$email, $confirm_email_uid, $ID]);
-
- $msg = "Vous venez de changer votre adresse mail. Veuillez désormais confirmer votre adresse mail en cliquant ici : $URL_BASE/confirmer_mail/$confirm_email_uid";
- mail($email, "Changement d'adresse mail - TFJM²", $msg, "From: $MAIL_ADDRESS\r\n");
- }
-
- return false;
-}
-
-function updatePassword()
-{
- global $DB, $YEAR;
-
- $old = htmlspecialchars($_POST["old_password"]);
- $new = htmlspecialchars($_POST["new_password"]);
- $confirm = htmlspecialchars($_POST["confirm_password"]);
-
- $result = $DB->query("SELECT `pwd_hash` FROM `users` WHERE `id` = '" . $_SESSION["user_id"] . "' AND `year` = '$YEAR';");
- if (($data = $result->fetch()) === FALSE)
- return "Le compte n'existe pas.";
-
- if (!password_verify($old, $data["pwd_hash"]))
- return "L'ancien mot de passe est incorrect.";
-
- if (strlen($new) < 8)
- return "Le mot de passe doit comporter au moins 8 caractères.";
-
- if ($new != $confirm)
- return "Les deux mots de passe sont différents.";
-
- $hash = password_hash($new, PASSWORD_BCRYPT);
-
- $DB->prepare("UPDATE `users` SET `pwd_hash` = ? WHERE `id` = ?;")->execute([$hash, $_SESSION["user_id"]]);
-
- return false;
-}
-
-?>
-
-
-
-Vous devez être connecté pour afficher cette page.";
- include "footer.php";
- return;
-} ?>
-
-Erreur : " . $error_message . ""; ?>
-
-
-
Votre compte a bien été mis à jour !
-
-
-
-
-
-
-
-
-
-
+query("SELECT * FROM `users` WHERE `id` = '" . $_SESSION["user_id"] . "';");
+ $user_data = $result->fetch();
+}
+
+function updateAccount()
+{
+ global $DB, $URL_BASE, $MAIL_ADDRESS;
+
+ if (!isset($_SESSION["user_id"]))
+ return "Vous n'êtes pas connecté.";
+
+ $ID = $_SESSION["user_id"];
+
+ $surname = htmlspecialchars($_POST["surname"]);
+ if (isset($surname) && $surname != "")
+ $DB->prepare("UPDATE `users` SET `surname` = ? WHERE `id` = ?;")->execute([$surname, $ID]);
+
+ $first_name = htmlspecialchars($_POST["firstname"]);
+ if (isset($first_name) && $first_name != "")
+ $DB->prepare("UPDATE `users` SET `first_name` = ? WHERE `id` = ?;")->execute([$first_name, $ID]);
+
+ $birth_date = htmlspecialchars($_POST["birth_date"]);
+ if (isset($birth_date) && $birth_date != "")
+ $DB->prepare("UPDATE `users` SET `birth_date` = ? WHERE `id` = ?;")->execute([$birth_date, $ID]);
+
+ if (isset($_POST["gender"])) {
+ $gender = htmlspecialchars($_POST["gender"]);
+ if (isset($gender) && ($gender == "M" || $gender == "F"))
+ $DB->prepare("UPDATE `users` SET `gender` = ? WHERE `id` = ?;")->execute([$gender, $ID]);
+ }
+
+ $address = htmlspecialchars($_POST["address"]);
+ if (isset($address) && $address != "")
+ $DB->prepare("UPDATE `users` SET `address` = ? WHERE `id` = ?;")->execute([$address, $ID]);
+
+ $postal_code = htmlspecialchars($_POST["postal_code"]);
+ if (isset($postal_code) && $postal_code != "")
+ $DB->prepare("UPDATE `users` SET `postal_code` = ? WHERE `id` = ?;")->execute([$postal_code, $ID]);
+
+ $city = htmlspecialchars($_POST["city"]);
+ if (isset($city) && $city != "")
+ $DB->prepare("UPDATE `users` SET `city` = ? WHERE `id` = ?;")->execute([$city, $ID]);
+
+ $country = htmlspecialchars($_POST["country"]);
+ if (isset($country) && $country != "")
+ $DB->prepare("UPDATE `users` SET `country` = ? WHERE `id` = ?;")->execute([$country, $ID]);
+
+ $phone_number = htmlspecialchars($_POST["phone_number"]);
+ if (isset($phone_number) && $phone_number != "")
+ $DB->prepare("UPDATE `users` SET `phone_number` = ? WHERE `id` = ?;")->execute([$phone_number, $ID]);
+
+ if (isset($_POST["school"])) {
+ $school = htmlspecialchars($_POST["school"]);
+ if (isset($school) && $school != "")
+ $DB->prepare("UPDATE `users` SET `school` = ? WHERE `id` = ?;")->execute([$school, $ID]);
+ }
+
+ if (isset($_POST["class"])) {
+ $class = htmlspecialchars($_POST["class"]);
+ if (isset($class) && ($class == "terminale" || $class == "premiere" || $class == "seconde"))
+ $DB->prepare("UPDATE `users` SET `class` = ? WHERE `id` = ?;")->execute([strtoupper($class), $ID]);
+ }
+
+ if (isset($_POST["responsible_name"])) {
+ $responsible_name = htmlspecialchars($_POST["responsible_name"]);
+ if (isset($responsible_name) && $responsible_name != "")
+ $DB->prepare("UPDATE `users` SET `responsible_name` = ? WHERE `id` = ?;")->execute([$responsible_name, $ID]);
+ }
+
+ if (isset($_POST["responsible_phone"])) {
+ $responsible_phone = htmlspecialchars($_POST["responsible_phone"]);
+ if (isset($responsible_phone) && $responsible_phone != "")
+ $DB->prepare("UPDATE `users` SET `responsible_phone` = ? WHERE `id` = ?;")->execute([$responsible_phone, $ID]);
+ }
+
+ if (isset($_POST["responsible_email"])) {
+ $responsible_email = htmlspecialchars($_POST["responsible_email"]);
+ if (isset($responsible_email) && $responsible_email != "")
+ $DB->prepare("UPDATE `users` SET `responsible_email` = ? WHERE `id` = ?;")->execute([$responsible_email, $ID]);
+ }
+
+ if (isset($_POST["description"])) {
+ $description = htmlspecialchars($_POST["description"]);
+ if (isset($description) && $description != "")
+ $DB->prepare("UPDATE `users` SET `description` = ? WHERE `id` = ?;")->execute([$description, $ID]);
+ }
+
+ $email = htmlspecialchars($_POST["email"]);
+ if (isset($email) && $email != "" && filter_var($email, FILTER_VALIDATE_EMAIL)) {
+ $confirm_email_uid = uniqid();
+ $DB->prepare("UPDATE `users` SET `email` = ?, `confirm_email` = ? WHERE `id` = ?;")->execute([$email, $confirm_email_uid, $ID]);
+
+ $msg = "Vous venez de changer votre adresse mail. Veuillez désormais confirmer votre adresse mail en cliquant ici : $URL_BASE/confirmer_mail/$confirm_email_uid";
+ mail($email, "Changement d'adresse mail - TFJM²", $msg, "From: $MAIL_ADDRESS\r\n");
+ }
+
+ return false;
+}
+
+function updatePassword()
+{
+ global $DB, $YEAR;
+
+ $old = htmlspecialchars($_POST["old_password"]);
+ $new = htmlspecialchars($_POST["new_password"]);
+ $confirm = htmlspecialchars($_POST["confirm_password"]);
+
+ $result = $DB->query("SELECT `pwd_hash` FROM `users` WHERE `id` = '" . $_SESSION["user_id"] . "' AND `year` = '$YEAR';");
+ if (($data = $result->fetch()) === FALSE)
+ return "Le compte n'existe pas.";
+
+ if (!password_verify($old, $data["pwd_hash"]))
+ return "L'ancien mot de passe est incorrect.";
+
+ if (strlen($new) < 8)
+ return "Le mot de passe doit comporter au moins 8 caractères.";
+
+ if ($new != $confirm)
+ return "Les deux mots de passe sont différents.";
+
+ $hash = password_hash($new, PASSWORD_BCRYPT);
+
+ $DB->prepare("UPDATE `users` SET `pwd_hash` = ? WHERE `id` = ?;")->execute([$hash, $_SESSION["user_id"]]);
+
+ return false;
+}
+
+?>
+
+
+
+Vous devez être connecté pour afficher cette page.";
+ require_once "footer.php";
+ return;
+} ?>
+
+Erreur : " . $error_message . ""; ?>
+
+
+
Votre compte a bien été mis à jour !
+
+
+
+
+
+
+
+
+
+
diff --git a/server_files/mon_equipe.php b/server_files/mon_equipe.php
index 4553d4e..92f6a40 100644
--- a/server_files/mon_equipe.php
+++ b/server_files/mon_equipe.php
@@ -1,6 +1,6 @@
-
+
Vous devez être dans une équipe pour afficher cette page.";
- include "footer.php";
+ require_once "footer.php";
return;
} ?>
@@ -364,4 +364,4 @@ Code d'accès :
-
+
diff --git a/server_files/rejoindre_equipe.php b/server_files/rejoindre_equipe.php
index 0463f5a..3e518ad 100644
--- a/server_files/rejoindre_equipe.php
+++ b/server_files/rejoindre_equipe.php
@@ -1,93 +1,93 @@
-query("SELECT * FROM `teams` WHERE `access_code` = '" . $access_code . "' AND `year` = '$YEAR';");
- if (($data = $result->fetch()) === FALSE)
- return "Ce code d'accès est invalide.";
-
- if ($_SESSION["role"] != "PARTICIPANT" && $_SESSION["role"] != "ENCADRANT")
- return "Seuls les participants et les encadrants peuvent rejoindre une équipe.";
-
- if ($data["validation_status"] != "NOT_READY")
- return "Cette équipe est déjà en cours de validation ou validée, vous ne pouvez pas la rejoindre.";
-
- for ($i = 1; $i <= $_SESSION["role"] == "PARTICIPANT" ? 6 : 2; ++$i) {
- if ($data[strtolower($_SESSION["role"]) . "_" . strval($i)] == NULL)
- break;
- }
-
- if ($_SESSION["role"] == "PARTICIPANT" && $i == 7 || $_SESSION["role"] == "ENCADRANT" && $i == 3)
- return "Il n'y a plus de place pour vous dans l'équipe.";
-
- $DB->prepare("UPDATE `users` SET `team_id` = ? WHERE `id` = " . $_SESSION["user_id"] . ";")->execute([$data["id"]]);
- /** @noinspection SqlResolve */
- $DB->prepare("UPDATE `teams` SET `" . strtolower($_SESSION["role"]) . "_" . strval($i) . "` = ? WHERE `id` = " . $data["id"] . ";")->execute([$_SESSION["user_id"]]);
-
- $_SESSION["team_id"] = $data["id"];
- $_SESSION["team_validation_status"] = $data["validation_status"];
-
- $msg = "Bonjour " . $_SESSION["first_name"] . " " . $_SESSION["surname"] . ",\r\n\r\n";
- $msg .= "Vous venez de rejoindre l'équipe « " . $data["name"] . " » (" . $data["trigram"] . ") pour le TFJM² de " . $data["name"] . " et nous vous en remercions.\r\n\r\n";
- $msg .= "Cordialement,\r\n\r\nL'organisation du TFJM² $YEAR";
- mail($_SESSION["email"], "Équipe rejointe TFJM² $YEAR", $msg, "From: $MAIL_ADDRESS\r\n");
-
- return false;
-}
-
-?>
-
-
-
-
-
Vous devez être participant ou encadrant pour pouvoir rejoindre une équipe.
-
- Vous avez bien rejoint l'équipe !
-
-
Vous êtes déjà dans une équipe.
-
-
-Erreur : " . $error_message . ""; ?>
-
-
-
-
-
-
+query("SELECT * FROM `teams` WHERE `access_code` = '" . $access_code . "' AND `year` = '$YEAR';");
+ if (($data = $result->fetch()) === FALSE)
+ return "Ce code d'accès est invalide.";
+
+ if ($_SESSION["role"] != "PARTICIPANT" && $_SESSION["role"] != "ENCADRANT")
+ return "Seuls les participants et les encadrants peuvent rejoindre une équipe.";
+
+ if ($data["validation_status"] != "NOT_READY")
+ return "Cette équipe est déjà en cours de validation ou validée, vous ne pouvez pas la rejoindre.";
+
+ for ($i = 1; $i <= $_SESSION["role"] == "PARTICIPANT" ? 6 : 2; ++$i) {
+ if ($data[strtolower($_SESSION["role"]) . "_" . strval($i)] == NULL)
+ break;
+ }
+
+ if ($_SESSION["role"] == "PARTICIPANT" && $i == 7 || $_SESSION["role"] == "ENCADRANT" && $i == 3)
+ return "Il n'y a plus de place pour vous dans l'équipe.";
+
+ $DB->prepare("UPDATE `users` SET `team_id` = ? WHERE `id` = " . $_SESSION["user_id"] . ";")->execute([$data["id"]]);
+ /** @noinspection SqlResolve */
+ $DB->prepare("UPDATE `teams` SET `" . strtolower($_SESSION["role"]) . "_" . strval($i) . "` = ? WHERE `id` = " . $data["id"] . ";")->execute([$_SESSION["user_id"]]);
+
+ $_SESSION["team_id"] = $data["id"];
+ $_SESSION["team_validation_status"] = $data["validation_status"];
+
+ $msg = "Bonjour " . $_SESSION["first_name"] . " " . $_SESSION["surname"] . ",\r\n\r\n";
+ $msg .= "Vous venez de rejoindre l'équipe « " . $data["name"] . " » (" . $data["trigram"] . ") pour le TFJM² de " . $data["name"] . " et nous vous en remercions.\r\n\r\n";
+ $msg .= "Cordialement,\r\n\r\nL'organisation du TFJM² $YEAR";
+ mail($_SESSION["email"], "Équipe rejointe TFJM² $YEAR", $msg, "From: $MAIL_ADDRESS\r\n");
+
+ return false;
+}
+
+?>
+
+
+
+
+
Vous devez être participant ou encadrant pour pouvoir rejoindre une équipe.
+
+ Vous avez bien rejoint l'équipe !
+
+
Vous êtes déjà dans une équipe.
+
+
+Erreur : " . $error_message . ""; ?>
+
+
+
+
+
+
diff --git a/server_files/solutions.php b/server_files/solutions.php
index 4699162..379ccde 100644
--- a/server_files/solutions.php
+++ b/server_files/solutions.php
@@ -1,9 +1,9 @@
-
+
fetch()) !== false) {
}
?>
-
+
diff --git a/server_files/solutions_orga.php b/server_files/solutions_orga.php
index 891e4be..8030be8 100644
--- a/server_files/solutions_orga.php
+++ b/server_files/solutions_orga.php
@@ -1,9 +1,9 @@
-
+
-
+
fetch()) !== false) {
?>
-
+
diff --git a/server_files/syntheses.php b/server_files/syntheses.php
index 4c720d8..96441d7 100644
--- a/server_files/syntheses.php
+++ b/server_files/syntheses.php
@@ -1,9 +1,9 @@
-
+
Il est trop tôt pour se préoccuper des notes de synthèse, attendez le tirage des poules.";
- include "footer.php";
+ require_once "footer.php";
}
if (isset($error_message)) {
@@ -120,4 +120,4 @@ while (($data = $syntheses_req->fetch()) !== false) {
}
?>
-
+
diff --git a/server_files/syntheses_orga.php b/server_files/syntheses_orga.php
index 6e336b6..1e5b1d2 100644
--- a/server_files/syntheses_orga.php
+++ b/server_files/syntheses_orga.php
@@ -1,9 +1,9 @@
-
+
-
+
fetch()) !== false) {
}
?>
-
+
diff --git a/server_files/tournoi.php b/server_files/tournoi.php
index 4855e01..4645ab4 100644
--- a/server_files/tournoi.php
+++ b/server_files/tournoi.php
@@ -1,6 +1,6 @@
execute([$tournament_name]);
$data = $response->fetch();
if ($data === false)
- include "404.php";
+ require_once "404.php";
$orgas_req = $DB->query("SELECT `users`.`id` AS `id`, `surname`, `first_name` FROM `users` JOIN `organizers` ON `users`.`id` = `organizer` WHERE `tournament` = " . $data["id"] . ";");
$orgas = [];
@@ -20,7 +20,7 @@ while (($orga_data = $orgas_req->fetch()) !== false) {
}
if (isset($_GET["modifier"]) && $_SESSION["role"] != "ADMIN" && !in_array($_SESSION["user_id"], $orgas_id))
- include "403.php";
+ require_once "403.php";
if (isset($_POST["edit_tournament"])) {
$error_message = updateTournament();
@@ -130,7 +130,7 @@ function updateTournament() {
?>
-
+
Tournoi de
@@ -356,4 +356,4 @@ else {
}
?>
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/server_files/tournois.php b/server_files/tournois.php
index 5d33359..5f160db 100644
--- a/server_files/tournois.php
+++ b/server_files/tournois.php
@@ -1,6 +1,6 @@
query("SELECT `name`, `date_start`, `date_end`, `date_inscription`, `date_solutions`, `size` FROM `tournaments`
WHERE `year` = '$YEAR' AND `final` = false ORDER BY `date_start`, `name`;");
@@ -8,7 +8,7 @@ $final_data = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_solutio
?>
-
+
Liste des tournois
@@ -55,4 +55,4 @@ $final_data = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_solutio
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/server_files/view_file.php b/server_files/view_file.php
index 3acf2fe..5b8fa4c 100644
--- a/server_files/view_file.php
+++ b/server_files/view_file.php
@@ -1,6 +1,6 @@