Compare commits
2
Commits
3ad5f5bdd6
...
3f4e859153
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f4e859153 | ||
|
|
f2bd887783 |
No files matched your search
+1
-1
@@ -65,7 +65,7 @@ class gbAPI {
|
||||
return false;
|
||||
}
|
||||
|
||||
function answer($status, $data) {
|
||||
function answer($status, $data = []) {
|
||||
http_response_code($status);
|
||||
Header ("Content-Type: application/json; charset=UTF-8");
|
||||
|
||||
|
||||
+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);
|
||||
Regular → Executable
File mode changed.
Reference in new issue
Block a user