Ciao ragazzi,
non riesco a far funzionare il login utilizzando il salvataggio della password con hash.
Il codice di registrazione dell'utente è il seguente dove cifro la password con un salt e vado a salvarla sul db:
Codice PHP:
if (isset($_REQUEST['username'])){        
...
tutti i parametri...      
$password stripslashes($_REQUEST['password']);        
$password mysqli_real_escape_string($con,$password);
$options=[            
'cost'=>10,             
'salt'=>'gcw7fZyAiWUTNEhGvt6Vqr'        ]; //opzioni della cifratura        
$crypt_password password_hash($passwordPASSWORD_BCRYPT$options);    //cifratura
        
$trn_date date("Y-m-d H:i:s");        $activated 0;
        
$token bin2hex(openssl_random_pseudo_bytes(16));        $url 'http://localhost:8888/form-1/verify.php';
        
$_SESSION['token'] = $token;        // Register user on database        
        
$check_user mysqli_query($con"SELECT username FROM users where username = '$username' or email = '$email'");
        if(
mysqli_num_rows($check_user) > 0){            
              echo(
"<h1>Username or email already exist!</h1>");        
        }else{            
              
$query "INSERT into `users` (username, name, lastname, birthdate, password_hash, email, token, activated, trn_date)             VALUES ('$username', '$name', '$lastname', '$birthdate',                     '$crypt_password', '$email', '$token', $activated, '$trn_date')";            
              
$result mysqli_query($con,$query); 
In fase di login invece eseguo le seguenti operazioni ma non funziona:

Codice PHP:
if (isset($_POST['username'])){                                                                                
...
tutti i parametri..                        
$password stripslashes($_REQUEST['password']);                                        
$password mysqli_real_escape_string($con,$password);

                                         
//Checking is user existing in the database or not                                        
$query "SELECT * FROM `users` WHERE username='$username' and birthdate='$birthdate' and activated='1' and password='$password'";                                        
$crypt_password "SELECT `password` FROM `users` WHERE username='$username'";
if (
password_verify($password$crypt_password)) {                                            
echo 
"Success!";                                        
}else{                                            
echo 
"Invalid!";                                        
}                                        
$result mysqli_query($con,$query) or die(mysql_error());                                        
$rows mysqli_num_rows($result);                                        
if(
$rows==1){                                            
$_SESSION['username'] = $username;                                            
$_SESSION['tentativi_login']=0;                                            
header("Location: home.php"); 
Sapete aiutarmi?

Grazie mille!