1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 18:17:28 +02:00

Amélioration de la classe d'ajout d'équipe

This commit is contained in:
galaxyoyo
2019-09-07 16:58:23 +02:00
parent e5e197dd38
commit 70cece8694
5 changed files with 101 additions and 49 deletions

View File

@ -92,7 +92,23 @@ function quitTeam() {
function userExists($email) {
global $DB, $YEAR;
$req = $DB->prepare("SELECT `email` FROM `users` WHERE `email` = ? AND `year` = '$YEAR';");
$req = $DB->prepare("SELECT `id` FROM `users` WHERE `email` = ? AND `year` = '$YEAR';");
$req->execute([$email]);
return !$req->fetch();
return $req->fetch();
}
function teamExists($name) {
global $DB, $YEAR;
$req = $DB->prepare("SELECT `id` FROM `teams` WHERE `name` = ? AND `year` = '$YEAR';");
$req->execute([$name]);
return $req->fetch();
}
function trigramExists($trigram) {
global $DB, $YEAR;
$req = $DB->prepare("SELECT `id` FROM `teams` WHERE `trigram` = ? AND `year` = '$YEAR';");
$req->execute([$trigram]);
return $req->fetch();
}