From 8972a151069ed307a15449a035f3ea0805926e25 Mon Sep 17 00:00:00 2001 From: BRAMAS Arthur Date: Fri, 10 Oct 2025 10:58:21 +0200 Subject: [PATCH] Update gitignore --- .gitignore | 3 ++- controller/AuthController.php | 13 ++++++------- public/index.php | 8 +++++++- view/{ConnForm.php => ConnFormView.php} | 0 4 files changed, 15 insertions(+), 9 deletions(-) rename view/{ConnForm.php => ConnFormView.php} (100%) diff --git a/.gitignore b/.gitignore index 3d79ace..3aa3b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -_base/ \ No newline at end of file +_base/ +_old/ \ No newline at end of file diff --git a/controller/AuthController.php b/controller/AuthController.php index 495e910..6ea9a85 100644 --- a/controller/AuthController.php +++ b/controller/AuthController.php @@ -7,12 +7,10 @@ class AuthController { } public function displayConnForm() { - include __DIR__."/../view/ConnForm.php"; + include __DIR__."/../view/ConnFormView.php"; } - public function handleConnForm() { - session_start(); - require_once __DIR__."/../utils_inc/inc_pdo.php"; // $pdo existe ici désormais + public function handleConnForm($cnx) { // http://localhost/contribs/traiterAuthentification.php?login=M001&pass=123 // Recevoir les données du form de login, et vérifier login/pass dans la base @@ -25,23 +23,24 @@ class AuthController { $textR = "select droit, password "; $textR.= "from membre "; $textR.= "where id=:login "; - $req = $pdo->prepare($textR); + $req = $cnx->prepare($textR); $req->bindParam(":login", $login); $req->execute(); // 2 possibilités : 1 ligne retournée ou 0 ligne retournée + $tabRes = $req->fetchAll(PDO::FETCH_ASSOC); if (count($tabRes)!=1) { // pas trouvé => retour au formulaire de co // die("Erreur de co"); - header("Location:../index.php?message=tekitoa"); + include __DIR__."/../view/ConnForm.php"; exit(); } // Si on arrive là : login existe (count==1) if (!password_verify($pass, $tabRes[0]["password"])){ // die("Erreur de co"); - header("Location:../index.php?message=tekitoa"); + include __DIR__."/../view/ConnForm.php"; exit(); } diff --git a/public/index.php b/public/index.php index 05f3c3a..8d2b22a 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,10 @@ handleConnForm(); + $ctr->handleConnForm($pdo); exit(); } + + echo"UNKNOWN ROUTE ALERT ALERT ALERT"; \ No newline at end of file diff --git a/view/ConnForm.php b/view/ConnFormView.php similarity index 100% rename from view/ConnForm.php rename to view/ConnFormView.php