<?php
require_once __DIR__ . '/db.php';
$db = db();

// Skift selv disse:
$username = 'admin';
$password = 'demo';
$role = 'admin';

// Tjek om brugeren findes
$st = $db->prepare('SELECT id FROM users WHERE username = ?');
$st->execute([$username]);
if ($st->fetch()) {
    echo "❗Brugeren '$username' findes allerede.";
    exit;
}

$hash = password_hash($password, PASSWORD_DEFAULT);
$st = $db->prepare('INSERT INTO users (username, password, role) VALUES (?, ?, ?)');
$st->execute([$username, $hash, $role]);

echo "✅ Bruger oprettet: $username / $password (rolle: $role)";
