From 88dda157b533215f49b78c9bcc1b9e8c8c909aae Mon Sep 17 00:00:00 2001 From: Trygve Date: Mon, 27 Oct 2025 15:18:24 +0100 Subject: [PATCH] =?UTF-8?q?Lagde=20config=20fil=20og=20side=20for=20=C3=A5?= =?UTF-8?q?=20endre=20starttidspunkt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin.php | 1 + config.php | 41 ++++++++++++++++++++++++++++++++++ config_editor.html | 55 ++++++++++++++++++++++++++++++++++++++++++++++ db_editor.html | 4 ++-- is_authorized.php | 2 +- passing.php | 4 ++-- registrering.php | 1 + runner.php | 4 ++-- table.php | 11 +++++----- 9 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 config.php create mode 100644 config_editor.html diff --git a/admin.php b/admin.php index 0132bf2..0b0a4a0 100644 --- a/admin.php +++ b/admin.php @@ -13,6 +13,7 @@
  • 📊 Dashbord
  • ⏱️ Registrer passering på matpost/mål
  • 👥 Endre løperbase
  • +
  • ⚙️ Konfigurasjon
  • diff --git a/config.php b/config.php new file mode 100644 index 0000000..f316144 --- /dev/null +++ b/config.php @@ -0,0 +1,41 @@ + $values) { + if (is_array($values)) { + $content .= "[$section]\n"; + foreach ($values as $key => $val) { + $content .= "$key = \"$val\"\n"; + } + } else { + $content .= "$section = \"$values\"\n"; + } + $content .= "\n"; + } + file_put_contents($path, $content); +} + +$config = parse_ini_file("data/config.ini"); + +$hash = file_get_contents("data/hash.txt"); +$method = $_SERVER['REQUEST_METHOD']; +if ($method == "POST") { + $start_time = $_POST['start_time']; + + $password = $_POST['password']; + if (!password_verify($password, $hash)) { + http_response_code(response_code: 401); + } + else { + $file = 'data/config.ini'; + $config["start_date"] = $start_time . "+01"; + write_ini_file($config, $file); + header('Location: config_editor.html'); + } +} +elseif ($method == "GET"){ + print($config["start_date"]); +} + + diff --git a/config_editor.html b/config_editor.html new file mode 100644 index 0000000..2cb7566 --- /dev/null +++ b/config_editor.html @@ -0,0 +1,55 @@ + + + + + EKT + + + + + + + +

    Sett dato og tid startskuddet gikk:

    +
    + + + +
    + + + + + \ No newline at end of file diff --git a/db_editor.html b/db_editor.html index 1de73e3..dda6cc6 100644 --- a/db_editor.html +++ b/db_editor.html @@ -13,11 +13,11 @@
  • 📊 Dashbord
  • ⏱️ Registrer passering på matpost/mål
  • 👥 Endre løperbase
  • +
  • ⚙️ Konfigurasjon
  • Legg til løper

    - - +
    diff --git a/is_authorized.php b/is_authorized.php index e6a0464..308bb30 100644 --- a/is_authorized.php +++ b/is_authorized.php @@ -1,5 +1,5 @@ 📊 Dashbord
  • ⏱️ Registrer passering på matpost/mål
  • 👥 Endre løperbase
  • +
  • ⚙️ Konfigurasjon
  • diff --git a/runner.php b/runner.php index 022e0d2..5a83373 100644 --- a/runner.php +++ b/runner.php @@ -1,5 +1,5 @@