Fix Bugs and finish setup.php
This commit is contained in:
1 parent
3ad5f5bdd6
commit
f2bd887783
2 files changed
+19
-2
No files matched your search
+18
-1
@@ -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);
|
||||
Reference in new issue
Block a user