<?php
require_once __DIR__ . '/../config/config.php';

// 1. Generate a mathematically perfect hash for your server
$raw_password = 'adminpassword123';
$hashed_password = password_hash($raw_password, PASSWORD_BCRYPT);

try {
    // 2. Inject it directly into the database for the superadmin account
    $stmt = $pdo->prepare("UPDATE admins SET password = ? WHERE username = 'superadmin'");
    $stmt->execute([$hashed_password]);
    
    echo "<h3 style='color: green; font-family: sans-serif;'>Success! The database hash has been updated.</h3>";
    echo "<p style='font-family: sans-serif;'>You can now go back and log in with the password: <b>adminpassword123</b></p>";
    
} catch (PDOException $e) {
    echo "Database Error: " . $e->getMessage();
}
?>