<?php
include '../include/config.php';

$result = $conn->query("SELECT nurse_id, nurse_number, first_name, email, login_password FROM nurses WHERE nurse_number = 'NURSE001'");

if ($row = $result->fetch_assoc()) {
    echo "Nurse found: " . $row['first_name'] . "<br>";
    echo "Nurse ID: " . $row['nurse_number'] . "<br>";
    echo "Stored hash: " . $row['login_password'] . "<br>";
    
    $test_password = 'password123';
    if (password_verify($test_password, $row['login_password'])) {
        echo "<span style='color:green'>✅ Password 'password123' is CORRECT</span>";
    } else {
        echo "<span style='color:red'>❌ Password 'password123' is WRONG. Resetting...</span>";
        
        $new_hash = password_hash($test_password, PASSWORD_DEFAULT);
        $conn->query("UPDATE nurses SET login_password = '$new_hash' WHERE nurse_number = 'NURSE001'");
        echo "<br>Password reset to: password123";
    }
} else {
    echo "No nurse found with nurse_number = 'NURSE001'";
}
?>