<?php
/**
 * Jalankan sekali dari terminal untuk generate hash password admin:
 *   php setup_password.php
 *
 * Kemudian copy hasil hash ke database.sql atau jalankan query UPDATE-nya.
 */

$password = isset($argv[1]) ? $argv[1] : 'admin123';
$hash     = password_hash($password, PASSWORD_BCRYPT);

echo "Password : $password\n";
echo "Hash     : $hash\n\n";
echo "Query MySQL:\n";
echo "UPDATE users SET password='$hash' WHERE username='admin';\n\n";

// Verify
echo "Verifikasi: " . (password_verify($password, $hash) ? "OK ✓" : "GAGAL ✗") . "\n";
