<?php
if(!empty($_POST['enter'])){
    $sql = 'SELECT * FROM `users` WHERE
    `login` = :login';
    $sth = $dbh->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]);
    $sth->execute([
        "login" => $_POST['login']
    ]);
    $red = $sth->fetch();
        if($red && password_verify($_POST['password_hash'], $red['password_hash'])){
            setcookie("id", $red['id'], time() + 3600);
            setcookie("role_id", $red['role_id'], time() + 3600);
            header("Location: profile.php");
        }
        else{
            $error = "Неверный логин или пароль!";
        }
}
?>