changement plus coherent

This commit is contained in:
Yasder5 2026-02-24 19:55:58 +01:00
parent 0c6088d4da
commit 1b7527ab66
2 changed files with 8 additions and 7 deletions

View file

@ -76,19 +76,20 @@
$rqPrep->bindValue(":id", $userId, PDO::PARAM_INT);
$rqPrep->bindValue(":token", $token, PDO::PARAM_STR);
$rqPrep->bindValue(":exp",
//pour faire que le cookies soit valable 1 jours
date('Y-m-d H:i:s', time() + (24*60*60))
//pour faire que le cookies soit valable 15 jours
date('Y-m-d H:i:s', time() + (15*24*60*60))
, PDO::PARAM_STR);
return $rqPrep->execute();
}
public function getTokenUser(string $hash){
$strRq = $this->_db->prepare("SELECT token_user_id FROM tokens WHERE token_hash = :hash AND expires_at > NOW()");
return $strRq->execute(['hash' => $hash]);
$strRq = $this->_db->prepare("SELECT token_user_id FROM tokens WHERE token_hash = :hash AND token_expire_at > NOW()");
$strRq->execute(['hash' => $hash]);
return $strRq->fetch();
}
public function deleteToken(string $hash){
$stmt = $this->_db->prepare("DELETE FROM tokens WHERE token_hash = :hash");
$stmt->execute(['hash' => $hash]);
$strRq = $this->_db->prepare("DELETE FROM tokens WHERE token_hash = :hash");
return $strRq->execute(['hash' => $hash]);
}
public function update(object $objUser):bool{