diff --git a/pages/accueil.php b/_ancienneVersion/pages/accueil.php similarity index 100% rename from pages/accueil.php rename to _ancienneVersion/pages/accueil.php diff --git a/pages/gestionMembres.php b/_ancienneVersion/pages/gestionMembres.php similarity index 100% rename from pages/gestionMembres.php rename to _ancienneVersion/pages/gestionMembres.php diff --git a/pages/listeContribs.php b/_ancienneVersion/pages/listeContribs.php similarity index 100% rename from pages/listeContribs.php rename to _ancienneVersion/pages/listeContribs.php diff --git a/pages/listeContribsMembre.php b/_ancienneVersion/pages/listeContribsMembre.php similarity index 100% rename from pages/listeContribsMembre.php rename to _ancienneVersion/pages/listeContribsMembre.php diff --git a/traitements/insererContrib.php b/_ancienneVersion/traitements/insererContrib.php similarity index 100% rename from traitements/insererContrib.php rename to _ancienneVersion/traitements/insererContrib.php diff --git a/traitements/logout.php b/_ancienneVersion/traitements/logout.php similarity index 100% rename from traitements/logout.php rename to _ancienneVersion/traitements/logout.php diff --git a/traitements/traiterAuthentification.php b/_ancienneVersion/traitements/traiterAuthentification.php similarity index 100% rename from traitements/traiterAuthentification.php rename to _ancienneVersion/traitements/traiterAuthentification.php diff --git a/utils_inc/.htaccess_inactif b/_ancienneVersion/utils_inc/.htaccess_inactif similarity index 100% rename from utils_inc/.htaccess_inactif rename to _ancienneVersion/utils_inc/.htaccess_inactif diff --git a/utils_inc/inc_head.php b/_ancienneVersion/utils_inc/inc_head.php similarity index 100% rename from utils_inc/inc_head.php rename to _ancienneVersion/utils_inc/inc_head.php diff --git a/utils_inc/inc_navbar.php b/_ancienneVersion/utils_inc/inc_navbar.php similarity index 100% rename from utils_inc/inc_navbar.php rename to _ancienneVersion/utils_inc/inc_navbar.php diff --git a/utils_inc/inc_pdo.php b/_ancienneVersion/utils_inc/inc_pdo.php similarity index 100% rename from utils_inc/inc_pdo.php rename to _ancienneVersion/utils_inc/inc_pdo.php diff --git a/controleurs/ControleurAuthentification.php b/controleurs/ControleurAuthentification.php new file mode 100644 index 0000000..0f3dcd1 --- /dev/null +++ b/controleurs/ControleurAuthentification.php @@ -0,0 +1,60 @@ +prepare("SELECT M.nom, M.Password, M.droit_id, D.LibDroit, M.id + FROM Membre M + INNER JOIN Droit D ON M.droit_id = D.idDroit + WHERE M.nom = :Login"); + $stmt->bindParam(':Login', $Login, PDO::PARAM_STR); + $stmt->execute(); + + $user = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($user && password_verify($password, $user['Password'])) { + $_SESSION['user'] = [ + 'idD' => $user['droit_id'], + 'idM' => $user['id'], + 'Login' => $user['nom'], + 'role' => $user['LibDroit'] + ]; + + // Redirection selon le rôle + if ($user['LibDroit'] === 'responsable') { + $message = urlencode("Connexion réussie. Bienvenue responsable : " . htmlspecialchars($user['nom']) . "!"); + header("Location: index.php?route=coucou&message=$message"); + } elseif ($user['LibDroit'] === 'dev') { + $message = urlencode(htmlspecialchars($user['nom']) ); + header("location: index.php?route=coucou&message=$message"); + } else { + $_SESSION['erreur'] = "Rôle inconnu"; + header("location:index.php?route=afficherFromCo"); + exit(); + } + } else { + $_SESSION['erreur'] = "Identifiants incorrects"; + header("location: index.php?route=afficherFromCo"); + exit(); + } + } catch (Exception $e) { + $_SESSION['erreur'] = "Erreur : " . $e->getMessage(); + header("location :index.php?route=afficherFromCo"); + exit(); + } + } + } + } + +} \ No newline at end of file diff --git a/css/bootstrap.min.css b/public/css/bootstrap.min.css similarity index 100% rename from css/bootstrap.min.css rename to public/css/bootstrap.min.css diff --git a/css/styles.css b/public/css/styles.css similarity index 100% rename from css/styles.css rename to public/css/styles.css diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..829e826 --- /dev/null +++ b/public/index.php @@ -0,0 +1,31 @@ + route reçue en get + define("BASE_URL","/contribsavantrouteur/"); + $route = isset($_GET["route"])? $_GET["route"] : null; + $pdo = new PDO("mysql:host=mysqlsrv;dbname=contrib", + "contrib_root", + "123abc"); + + if ($route=="coucou"){ + $ctr = new ControleurAuthentification; + $ctr->coucou(); + exit(); + } + + if ($route=="afficherFromCo"){ + $ctr = new ControleurAuthentification; + $ctr->afficherFromCo(); + exit(); + } + + if ($route=="traiterFromCo"){ + echo "Je suis là"; + $ctr = new ControleurAuthentification; + $ctr->traiterFromCo($pdo,$_POST["login"],$_POST["pass"]); + exit(); + } + + echo "Route inconnue"; \ No newline at end of file diff --git a/js/bootstrap.bundle.min.js b/public/js/bootstrap.bundle.min.js similarity index 100% rename from js/bootstrap.bundle.min.js rename to public/js/bootstrap.bundle.min.js diff --git a/index.php b/vues/VueFromCo.php similarity index 86% rename from index.php rename to vues/VueFromCo.php index 910e2a3..9f23a2b 100644 --- a/index.php +++ b/vues/VueFromCo.php @@ -6,7 +6,7 @@ - + Connexion @@ -14,7 +14,7 @@
-
+

Identifiez-vous