1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-27 11:02:22 +00:00
plateforme-tfjm2/server_files/controllers/confirmer_mail.php

23 lines
834 B
PHP
Raw Normal View History

2019-08-21 20:56:46 +00:00
<?php
$token = $_GET["token"];
2020-01-16 21:04:29 +00:00
$alert = "danger";
2019-08-21 20:56:46 +00:00
if (isset($token)) {
$result = $DB->query("SELECT `email` FROM `users` WHERE `confirm_email` = '$token' AND `year` = '$YEAR';");
if (($data = $result->fetch()) === FALSE)
$error_message = "Le jeton est invalide. Votre compte est peut-être déjà validé ?";
else {
$DB->exec("UPDATE `users` SET `confirm_email` = NULL WHERE `confirm_email` = '$token';");
$error_message = "Votre adresse mail a été validée ! Vous pouvez désormais vous connecter.";
2020-01-16 21:04:29 +00:00
$alert = "success";
2019-08-21 20:56:46 +00:00
}
}
else {
$error_message = "Il n'y a pas de compte à valider !";
2020-01-16 21:04:29 +00:00
$alert = "warning";
2019-08-21 20:56:46 +00:00
}
require_once "server_files/views/header.php";
2020-01-16 21:04:29 +00:00
echo "<div class=\"alert alert-$alert\"><h2>$error_message</h2></div>";
require_once "server_files/views/footer.php";