<?php

// Ubah sesuai konfigurasi database kamu
$db = new \mysqli("localhost", "root", "", "pos");

// Cek koneksi
if ($db->connect_error) {
    die("Koneksi gagal: " . $db->connect_error);
}

// Set username superadmin dan password baru
$username = 'admin1';
$passwordBaru = 'tanyaadmin'; // <- Ubah sesuai keinginan
$passwordHash = password_hash($passwordBaru, PASSWORD_DEFAULT);

// Update ke database
$stmt = $db->prepare("UPDATE users SET password = ? WHERE username = ?");
$stmt->bind_param("ss", $passwordHash, $username);

if ($stmt->execute()) {
    echo "✅ Password superadmin berhasil diperbarui.";
} else {
    echo "❌ Gagal memperbarui password: " . $stmt->error;
}

$stmt->close();
$db->close();
