This commit is contained in:
root committed 2026-10-05 18:48:47 +02:00
1 parent ae54fabd6b
commit 1a2e1cc33f
5 files changed
+25 -16

No files matched your search

+8 -1
View File
@@ -1,4 +1,11 @@
<?php
$debug = true;
if ($debug) {
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(E_ALL);
}
// API Main Library
class gbAPI {
function __construct($authRequired) {
@@ -78,7 +85,7 @@ class gbAPI {
function dbCommand($command, $expectResult, $stmtArgsRequired = false, $stmtArgs = []) {
$db_path = APP_PATH . "database.db";
$db = new PDO("sqlite:" . $db_path);
$db = new PDO("sqlite: " . $db_path);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare($command);
+2 -1
View File
@@ -46,7 +46,7 @@ $db_path = APP_PATH . "database.db";
$db = new PDO("sqlite:" . $db_path);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db = exec($sql_file);
$db->exec($sql_file);
@@ -57,3 +57,4 @@ $stmt = $db->prepare($command);
$stmt->execute([":username" => $username, ":password" => $hash, ":owner" => 1]);
$api->answer(200);
Executable → Regular
BIN
View File
Binary file not shown.
+9 -10
View File
@@ -1,15 +1,14 @@
CREATE TABLE IF NOT EXISTS "users" (
"id" INTEGER NOT NULL,
"username" VARCHAR NOT NULL,
"password" VARCHAR NOT NULL,
"owner" INTEGER NOT NULL,
PRIMARY KEY("id", "username", "owner")
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"username" TEXT NOT NULL UNIQUE,
"password" TEXT NOT NULL,
"owner" INTEGER NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS "entrys" (
"id" INTEGER NOT NULL,
"name" VARCHAR NOT NULL,
"text" VARCHAR NOT NULL,
"status" INTEGER,
PRIMARY KEY("id")
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL,
"text" TEXT NOT NULL,
"status" INTEGER NOT NULL DEFAULT 0
);
+6 -4
View File
@@ -6,9 +6,11 @@
//echo $_SERVER["HTTP_X_API_KEY"];
$string = '{"user":"marc", "auth":true}';
$secret = "281361f952279bd9530734c67ed04aed2756f0fe00cb998cd6c28324f491484c";
//$string = '{"user":"marc", "auth":true}';
//$secret = "281361f952279bd9530734c67ed04aed2756f0fe00cb998cd6c28324f491484c";
echo "Hash: " . hash_hmac("sha256", $string, $secret);
//echo "Hash: " . hash_hmac("sha256", $string, $secret);
echo "Decode: " . hash_equals($string, $secret);
//echo "Decode: " . hash_equals($string, $secret);
print_r(PDO::getAvailableDrivers());