From fdddbbb0ef47bcee556fb944275e21470246ee37 Mon Sep 17 00:00:00 2001 From: Trygve Date: Tue, 28 Oct 2025 23:46:42 +0100 Subject: [PATCH] La til epost knapp --- admin.php | 9 ++++++++- api/config.php | 5 +++-- api/email.php | 25 +++++++++++++++++++++++++ api/runner.php | 2 ++ config_editor.html | 5 +++-- db_editor.html | 4 +++- lib/htmx.min.js | 1 + paameldte.php | 2 +- 8 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 api/email.php create mode 100644 lib/htmx.min.js diff --git a/admin.php b/admin.php index b2fb3e2..e1810b5 100644 --- a/admin.php +++ b/admin.php @@ -46,6 +46,13 @@
+ + + + +
+ +

Løpende resultater

- + \ No newline at end of file diff --git a/api/config.php b/api/config.php index d897b07..059db30 100644 --- a/api/config.php +++ b/api/config.php @@ -13,7 +13,7 @@ function write_ini_file($assoc_array, $path) { } $content .= "\n"; } - file_put_contents($path, $content); + file_put_contents($path, data: $content); } $config = parse_ini_file("$documentRoot/data/config.ini"); @@ -31,7 +31,8 @@ if ($method == "POST") { $file = "$documentRoot/data/config.ini"; $config["start_date"] = $start_time . "+01"; write_ini_file($config, $file); - header("Location: $documentRoot/config_editor.html"); + header("HX-Replace-Url: false"); + echo("Starttida er oppdatert til: $start_time"); } } elseif ($method == "GET"){ diff --git a/api/email.php b/api/email.php new file mode 100644 index 0000000..f13f743 --- /dev/null +++ b/api/email.php @@ -0,0 +1,25 @@ +email; + if (!isset($query['course'])){ + $emails .= "$email, "; + } + elseif ($course == $runners[$i]->course) { + $emails .= "$email, "; + } + } + echo($emails); +} \ No newline at end of file diff --git a/api/runner.php b/api/runner.php index 3a6e21c..59b9293 100644 --- a/api/runner.php +++ b/api/runner.php @@ -23,6 +23,8 @@ if ($method == "POST") { else { $file = "$documentRoot/data/db.csv"; file_put_contents($file, $line, FILE_APPEND); + header("HX-Replace-Url: false"); + echo("Løper lagt til: $line"); } } if ($method == "GET") { diff --git a/config_editor.html b/config_editor.html index 5a4dc1b..35b2b24 100644 --- a/config_editor.html +++ b/config_editor.html @@ -24,7 +24,7 @@

Sett dato og tid startskuddet gikk:

-
+
- +
+ \ No newline at end of file diff --git a/db_editor.html b/db_editor.html index f57e0c1..0d3d347 100644 --- a/db_editor.html +++ b/db_editor.html @@ -23,7 +23,7 @@

Legg til løper

-
+