<?php
$new_password = $_POST['new_password'];
$hash = password_hash($new_password, PASSWORD_DEFAULT);

mysqli_query($conn, "
    INSERT INTO user_passwords (user_id, password_hash)
    VALUES ('".$_SESSION['user_id']."', '$hash')
");

unset($_SESSION['new_device']);

header("Location: dashboard.php");

 ?>