Fix Bugs and finish setup.php

This commit is contained in:
admin committed 2026-10-05 09:09:07 +00:00
1 parent 3ad5f5bdd6
commit f2bd887783
2 files changed
+19 -2

No files matched your search

+18 -1
View File
@@ -37,4 +37,21 @@ $hash = password_hash($password);
// CREATE DATABASE STRUCTURE
file_get_contents(APP_PATH . "db_structure.sql");
$sql_file = file_get_contents(APP_PATH . "db_structure.sql");
$db_path = APP_PATH . "database.db";
$db = new PDO("sqlite:" . $db_path);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db = exec($sql_file);
// INSERT USER
$command = "INSERT INTO users (username, password, owner) VALUES (:username, :password, :owner)";
$stmt = $db->prepare($command);
$stmt->execute([":username" => $username, ":password" => $hash, ":owner" => 1]);
$api->answer(200);