From 33b89849d0ad9dd8dae5c4abda96b7a48dfb6d35 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 29 Jul 2024 10:41:33 +0000 Subject: [PATCH] fix(admin-panels): include paths --- admin/auth.php | 5 ++++- admin/backups.php | 4 ++-- admin/commands.php | 4 ++-- admin/connections.php | 4 ++-- admin/console.php | 4 ++-- admin/console_action.php | 4 ++-- admin/databases.php | 4 ++-- admin/download.php | 2 +- admin/include/footer.php | 18 +++++++++--------- admin/include/header.php | 4 ++-- admin/index.php | 4 ++-- admin/latency.php | 4 ++-- admin/login.php | 2 +- admin/login_action.php | 6 +++--- admin/logs.php | 4 ++-- admin/plugins.php | 4 ++-- admin/settings.php | 4 ++-- admin/stats.php | 4 ++-- admin/upload_action.php | 4 ++-- admin/users.php | 4 ++-- vercel.json | 14 +++++++------- 21 files changed, 55 insertions(+), 52 deletions(-) diff --git a/admin/auth.php b/admin/auth.php index d9d8bce..2307a5b 100644 --- a/admin/auth.php +++ b/admin/auth.php @@ -3,11 +3,14 @@ session_set_cookie_params(0); session_start(); +echo var_dump($_SESSION); + // check if there is no valid session or if session is expired $session_max_time = 60 * 600; // 60 minutes if ((!isset($_SESSION['username'])) || (isset($_SESSION['start']) && (time() - $_SESSION['start'] >= $session_max_time))) { session_unset(); session_destroy(); - header("Location: login.php"); + echo var_dump($_SESSION); + //header("Location: login.php"); exit(); } diff --git a/admin/backups.php b/admin/backups.php index 891b267..8940ff5 100644 --- a/admin/backups.php +++ b/admin/backups.php @@ -1,4 +1,4 @@ - +
@@ -12,4 +12,4 @@
- + diff --git a/admin/commands.php b/admin/commands.php index 1011f5c..5179d76 100644 --- a/admin/commands.php +++ b/admin/commands.php @@ -1,4 +1,4 @@ - +
@@ -12,4 +12,4 @@
- + diff --git a/admin/connections.php b/admin/connections.php index 543a99f..40e0527 100644 --- a/admin/connections.php +++ b/admin/connections.php @@ -1,4 +1,4 @@ - +
@@ -12,4 +12,4 @@
- + diff --git a/admin/console.php b/admin/console.php index d160e5b..327a4c2 100644 --- a/admin/console.php +++ b/admin/console.php @@ -1,4 +1,4 @@ - +
@@ -34,4 +34,4 @@ global $jsinclude; $jsinclude = "console.js"; ?> - + diff --git a/admin/console_action.php b/admin/console_action.php index 9685f61..74c6970 100644 --- a/admin/console_action.php +++ b/admin/console_action.php @@ -2,8 +2,8 @@ use SQLiteCloud\SQLiteCloudRowset; -include_once('auth.php'); -include_once('common.php'); +include_once(__DIR__ . '/auth.php'); +include_once(__DIR__ . '/common.php'); $data = json_decode(file_get_contents('php://input'), true); $database = $data["database"]; diff --git a/admin/databases.php b/admin/databases.php index f4865a0..96cf5fe 100644 --- a/admin/databases.php +++ b/admin/databases.php @@ -1,4 +1,4 @@ - +
@@ -46,4 +46,4 @@ function on_column($value, $row, $col) global $jsinclude; $jsinclude = "upload.js"; ?> - + diff --git a/admin/download.php b/admin/download.php index 57e4196..fe1a7f8 100644 --- a/admin/download.php +++ b/admin/download.php @@ -1,6 +1,6 @@ ' . $jscript . ''; - } - if (isset($jsinclude)) { - echo ''; - } - echo "\n"; - ?> + if (isset($jscript)) { + echo ''; + } + if (isset($jsinclude)) { + echo ''; + } + echo "\n"; + ?> diff --git a/admin/include/header.php b/admin/include/header.php index bb5d81b..6e40c09 100644 --- a/admin/include/header.php +++ b/admin/include/header.php @@ -1,6 +1,6 @@ diff --git a/admin/index.php b/admin/index.php index 35106a8..22ab5ec 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,4 +1,4 @@ - +
@@ -21,4 +21,4 @@
- + diff --git a/admin/latency.php b/admin/latency.php index b774af4..a638725 100644 --- a/admin/latency.php +++ b/admin/latency.php @@ -1,4 +1,4 @@ - +
@@ -12,4 +12,4 @@
- + diff --git a/admin/login.php b/admin/login.php index 5b4b40d..38393a3 100644 --- a/admin/login.php +++ b/admin/login.php @@ -1,4 +1,4 @@ - + diff --git a/admin/login_action.php b/admin/login_action.php index 29d668a..8dd6d10 100644 --- a/admin/login_action.php +++ b/admin/login_action.php @@ -6,13 +6,13 @@ $password = $data["password"]; $port = $data["port"]; -include_once('common.php'); +include_once(__DIR__ . '/common.php'); $rc = do_real_connect($hostname, $port, $username, $password); $r = null; if ($rc === true) { // successfully connected - $r = array('result' => 1); + $r = ['result' => 1]; $_SESSION['start'] = time(); $_SESSION['port'] = $port; $_SESSION['hostname'] = $hostname; @@ -20,7 +20,7 @@ $_SESSION['password'] = $password; } else { // error - $r = array('result' => 0, 'msg' => $rc); + $r = ['result' => 0, 'msg' => $rc]; } echo json_encode($r); diff --git a/admin/logs.php b/admin/logs.php index 11d6071..0f12f7b 100644 --- a/admin/logs.php +++ b/admin/logs.php @@ -1,4 +1,4 @@ - +
@@ -43,4 +43,4 @@ function on_column($value, $row, $col)
- + diff --git a/admin/plugins.php b/admin/plugins.php index c4b3d93..a94cfe7 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -1,4 +1,4 @@ - +
@@ -12,4 +12,4 @@
- + diff --git a/admin/settings.php b/admin/settings.php index ab43218..c9b8313 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -1,4 +1,4 @@ - +
@@ -12,4 +12,4 @@
- + diff --git a/admin/stats.php b/admin/stats.php index 06b4a80..cb02791 100644 --- a/admin/stats.php +++ b/admin/stats.php @@ -1,4 +1,4 @@ - +
@@ -34,4 +34,4 @@ $jscript = $script1 . "\n" . $script2 . "\n" . $script3 . "\n" . $script4 . "\n"; ?> - + diff --git a/admin/upload_action.php b/admin/upload_action.php index 82d2da9..ded2461 100644 --- a/admin/upload_action.php +++ b/admin/upload_action.php @@ -1,7 +1,7 @@ +
@@ -12,4 +12,4 @@
- + diff --git a/vercel.json b/vercel.json index 81724bd..4207717 100644 --- a/vercel.json +++ b/vercel.json @@ -1,13 +1,13 @@ { + "version": 2, "builds": [ { "src": "admin/**/*.php", - "use": "vercel-php@0.3.6", - "config": { - "includeFiles": [ - "admin/**/*" - ] - } + "use": "vercel-php@0.5.5" + }, + { + "src": "admin/**/*", + "use": "@vercel/static" } ], "routes": [ @@ -16,4 +16,4 @@ "dest": "/admin/$1" } ] -} +} \ No newline at end of file