Correction 'Authentification.php'

This commit is contained in:
xdrm-brackets 2016-07-14 09:36:18 +02:00
parent 9ef1f25a3a
commit d12148e809
2 changed files with 7 additions and 8 deletions

View File

@ -113,9 +113,9 @@
/* (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']
];
}

View File

@ -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