From 313ffec92caf6345c4df4b1e2744f6c6f274d06d Mon Sep 17 00:00:00 2001 From: hacker_marc Date: Fri, 9 Oct 2026 21:21:44 +0200 Subject: [PATCH] Update file permissions and enhance error handling in login template and setup scripts --- api/auth/isauth.php | 0 api/entrys/add.php | 0 api/entrys/get.php | 0 api/settings/appname.php | 0 api/setup/save.php | 8 ++++++++ public/templates/login/login.html | 24 ++++++++++++++++++++++++ public/test.php | 5 ++++- 7 files changed, 36 insertions(+), 1 deletion(-) mode change 100644 => 100755 api/auth/isauth.php mode change 100644 => 100755 api/entrys/add.php mode change 100644 => 100755 api/entrys/get.php mode change 100644 => 100755 api/settings/appname.php mode change 100644 => 100755 public/templates/login/login.html diff --git a/api/auth/isauth.php b/api/auth/isauth.php old mode 100644 new mode 100755 diff --git a/api/entrys/add.php b/api/entrys/add.php old mode 100644 new mode 100755 diff --git a/api/entrys/get.php b/api/entrys/get.php old mode 100644 new mode 100755 diff --git a/api/settings/appname.php b/api/settings/appname.php old mode 100644 new mode 100755 diff --git a/api/setup/save.php b/api/setup/save.php index 1993ac0..3f6362d 100755 --- a/api/setup/save.php +++ b/api/setup/save.php @@ -29,6 +29,14 @@ if (is_file(APP_PATH . "database.db")) { ]); } +// Check PDO drivers +if (!extension_loaded("pdo_sqlite") || !extension_loaded("sqlite3")) { + $api->answer(500, [ + "error" => "missing_drives", + "error_text" => "Please install the extensions pdo_sqlite and sqlite3." + ]); +} + $username = $input["username"]; $password = $input["password"]; $password_repeat = $input["password_repeat"]; diff --git a/public/templates/login/login.html b/public/templates/login/login.html old mode 100644 new mode 100755 index 1b23f80..56b65ac --- a/public/templates/login/login.html +++ b/public/templates/login/login.html @@ -36,6 +36,7 @@

%appname%

Admin Panel Login



+



Login @@ -46,6 +47,29 @@ var username = document.getElementById("login_username").value; var password = document.getElementById("login_password").value; + fetch("/api/auth/login.php", { + method:"POST", + body: JSON.stringify({ + username: username, + password: password + }), + headers: { + "Content-type": "application/json; charset=UTF-8" + } + }) + .then(response => response.json()) + .then(data => { + if (data.status == 200) { + window.location.reload(); + }else{ + document.getElementById("error_msg").innerHTML = data.error_text; + document.getElementById("error_msg").style.display = "block"; + } + }) + .catch(error => { + document.getElementById("error_msg").innerHTML = error; + document.getElementById("error_msg").style.display = "block"; + }) }); diff --git a/public/test.php b/public/test.php index c85de7b..c8c05b2 100755 --- a/public/test.php +++ b/public/test.php @@ -17,4 +17,7 @@ //print_r(json_decode('{"entrys":[{"name":"marc"}]}', true)); -print_r(explode(".", "jakob.stinkt")); \ No newline at end of file +//print_r(explode(".", "jakob.stinkt")); + +var_dump(extension_loaded("pdo_sqlite")); +var_dump(extension_loaded("sqlite3")); \ No newline at end of file