<?php

session_start();
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
    header("Location: index.php");
    exit;
}

include("include/connection.php");

$conn = new mysqli($host, $user, $password, $dbname);

$username = "town";
$password = password_hash("admin123@", PASSWORD_DEFAULT);

$stmt = $conn->prepare("INSERT INTO users (username, password, role) VALUES (?, ?, 'admin')");
$stmt->bind_param("ss", $username, $password);
$stmt->execute();

echo "Admin created.";
