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


$username = 'admin1';
$password = 'Admin123'; 
$role = 'admin';


$hashedPassword = password_hash($password, PASSWORD_DEFAULT);


$check = mysqli_query($conn, "SELECT * FROM users WHERE username='$username'");
if(mysqli_num_rows($check) > 0){
    die("Username sudah ada, gunakan username lain.");
}


$sql = "INSERT INTO users (username, password, role) VALUES ('$username', '$hashedPassword', '$role')";
if(mysqli_query($conn, $sql)){
    echo "Admin berhasil dibuat!<br>";
    echo "Username: $username<br>";
    echo "Password: $password";
}else{
    echo "Gagal membuat admin: " . mysqli_error($conn);
}
?>
