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

$username = 'admin';
$new_password = 'admin123';
$hashed_password = password_hash($new_password, PASSWORD_DEFAULT);

$stmt = $conn->prepare("UPDATE users SET password = ? WHERE username = ?");
$stmt->bind_param("ss", $hashed_password, $username);

if ($stmt->execute()) {
    if ($stmt->affected_rows > 0) {
        echo "<h3>Berhasil!</h3>";
        echo "Password untuk username <b>admin</b> telah direset menjadi: <b>admin123</b><br>";
        echo "<a href='login.html'>Klik di sini untuk Login</a>";
    } else {
        echo "<h3>Gagal!</h3>";
        echo "Username 'admin' tidak ditemukan di database. Pastikan Anda sudah mengimpor database.sql.";
    }
} else {
    echo "Terjadi kesalahan: " . $conn->error;
}

$stmt->close();
?>
