Fix Bugs
This commit is contained in:
1 parent
ae54fabd6b
commit
1a2e1cc33f
5 files changed
+24
-15
No files matched your search
@@ -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) {
|
||||
|
||||
+2
-1
@@ -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
Binary file not shown.
+9
-10
@@ -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
@@ -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());
|
||||
Reference in new issue
Block a user