Как вы видите, я хочу сравнить псевдо-работу с MySQL bd password_verif
, но псевдо-это не функция.
Router.php:
elseif ($_GET['action'] == 'connect') {
$connect = new ControllerLog();
$connect->connect($_POST['password'], $_POST['pseudo']);
}
Контроллер:
function connect($result)
{
$userManager = new \blog_ecrivain\Model\UserManager();
$passwordUser = $userManager->log();
$isPasswordOK = password_verify($result, $passwordUser['password']);
if (!$isPasswordOK)
{
$errormdp='Erreur : mot de passe incorrect !';
echo '<script>window.alert("'.$errormdp.'");</script>';
echo" <script>window.location='index.php?action=writepost';</script>";
}
else
{
$_SESSION['connect'] = true;
header ('location:./index.php?action=dashboard');
}
}
Модель:
public function log()
{
$db = Manager::dbConnect();
$req = $db->prepare('SELECT id, pseudo, password FROM administration');
$result = $req->execute();
$result = $req->fetch();
return $result;
}