v0.0..1
This commit is contained in:
Thomas
2025-10-05 14:58:05 +02:00
parent df30542248
commit a184c31cca
41 changed files with 3439 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?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)";