diff --git a/admin.php b/admin.php
index 6098f7b..3483bcd 100644
--- a/admin.php
+++ b/admin.php
@@ -57,9 +57,9 @@ include("api/statistics.php");
-
-
-
+
+
+
diff --git a/api/config.php b/api/config.php
index 340c658..69b5575 100644
--- a/api/config.php
+++ b/api/config.php
@@ -22,8 +22,11 @@ include("$documentRoot/data/hash.php");
$method = $_SERVER['REQUEST_METHOD'];
if ($method == "POST") {
$start_time = $_POST['start_time'];
+ $start_time_mini = $_POST['mini_time'];
+
+ $password = $_POST['Password'];
+ $password = getallheaders()['Password'];
- $password = $_POST['password'];
$new_time = DateTime::createFromFormat(DateTime::ISO8601, $start_time. "+01");
if (!password_verify($password, $hash)) {
@@ -35,13 +38,30 @@ if ($method == "POST") {
$file = "$documentRoot/data/config.ini";
$config["start_date"] = $start_time . "+01";
+ $config["start_date_mini"] = $start_time_mini . "+01";
write_ini_file($config, $file);
header("HX-Replace-Url: false");
- echo("Starttida er oppdatert til: $start_time");
+ echo("Starttida er oppdatert til: $start_time for Kadaver'n
$start_time_mini for Minikadaer'n");
}
}
elseif ($method == "GET"){
- print($config["start_date"]);
+ $start_kadaver = explode("+", $config["start_date"])[0];
+ $start_mini = explode("+", $config["start_date_mini"])[0];
+ $response = "
+
+
+ ";
+ echo($response);
}
diff --git a/api/email.php b/api/email.php
index 73a4539..a0c22e0 100644
--- a/api/email.php
+++ b/api/email.php
@@ -6,20 +6,22 @@ $method = $_SERVER['REQUEST_METHOD'];
if ($method == "GET") {
parse_str($_SERVER['QUERY_STRING'], $query);
$course = $query['course'];
- $password = getallheaders()['password'];
+ $password = getallheaders()['Password'];
+ print_r(getallheaders());
if (!password_verify($password, $hash)) {
http_response_code(response_code: 401);
+ } else {
+ $runners = read_runners_from_csv();
+ $emails = "";
+ for ($i = 0; $i < count($runners); $i++) {
+ $email = $runners[$i]->email;
+ if (!isset($query['course'])){
+ $emails .= "$email, ";
+ }
+ elseif ($course == $runners[$i]->course) {
+ $emails .= "$email, ";
+ }
+ }
+ echo($emails);
}
- $runners = read_runners_from_csv();
- $emails = "";
- for ($i = 0; $i < count($runners); $i++) {
- $email = $runners[$i]->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/config_editor.html b/config_editor.html
index 0d4ec06..65129a1 100644
--- a/config_editor.html
+++ b/config_editor.html
@@ -29,16 +29,7 @@
Sett dato og tid startskuddet gikk:
-
-
-
+