From d12148e80985ae7b7311a6421ef570b0ee673abd Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 14 Jul 2016 09:36:18 +0200 Subject: [PATCH] Correction 'Authentification.php' --- manager/Authentification.php | 8 ++++---- manager/module/authentificationDefault.php | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manager/Authentification.php b/manager/Authentification.php index 3b15a50..b42b7c1 100644 --- a/manager/Authentification.php +++ b/manager/Authentification.php @@ -110,12 +110,12 @@ /* (1) Si le token n'existe pas, on retourne une erreur */ if( $checkBranch->answer() == false ) return false; - + /* (2) On met à jour les informations de l'administrateur */ $_SESSION['ADMIN'] = [ - 'id' => (int) $checkBranch->answer()[0]['id_admin'], - 'username' => $checkBranch->answer()[0]['username'], - 'mail' => $checkBranch->answer()[0]['mail'] + 'id' => (int) $checkBranch->answer()['id_admin'], + 'username' => $checkBranch->answer()['username'], + 'mail' => $checkBranch->answer()['mail'] ]; } diff --git a/manager/module/authentificationDefault.php b/manager/module/authentificationDefault.php index 7d1adfa..ca09d88 100644 --- a/manager/module/authentificationDefault.php +++ b/manager/module/authentificationDefault.php @@ -73,7 +73,6 @@ public static function admin($params){ extract($params); - /* [0] Par défaut, on déconnecte l'administrateur =========================================================*/ $_SESSION['AUTH'][1] = ''; @@ -89,7 +88,7 @@ $usernameFetched = $getUsername->answer(); // Si aucun résultat, on retourne le status FALSE - if( count($usernameFetched) == 0 ) + if( $usernameFetched === false ) return [ 'status' => false ]; @@ -98,13 +97,13 @@ $hash_password = sessionManager::secure_hash($password); // Si mot de passe faux, on retourne le status FALSE - if( $usernameFetched[0]['password'] != $hash_password ) + if( $usernameFetched['password'] != $hash_password ) return [ 'status' => false ]; /* [3] On définit le token =========================================================*/ - $_SESSION['AUTH'][1] = $usernameFetched[0]['token']; + $_SESSION['AUTH'][1] = $usernameFetched['token']; // On retourne le status