Compare commits

..

No commits in common. "6825e90568280d80fbce3ada61c422fbe2280755" and "5b62326c42306d6be9dcca838cd5a3fea996bb3f" have entirely different histories.

13 changed files with 183 additions and 177 deletions

View File

@ -33,10 +33,10 @@
<li class="disabled"><a href="/registrering.php">⏱️ Registrer passering matpost/mål</a></li> <li class="disabled"><a href="/registrering.php">⏱️ Registrer passering matpost/mål</a></li>
<li class="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li> <li class="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li>
<li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li> <li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
<li class="disabled">⏳️ Nedtelling matpost <li class="selected">⏳️ Nedtelling matpost
<menu> <menu>
<li><a href="/matpost_nedtelling.php?matpost=0">1. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=0">1. mat</a></li>
<li><a href="/matpost_nedtelling.php?matpost=1">2. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=1">2. mat</a></li>
</menu> </menu>
</li> </li>
</menu> </menu>
@ -48,7 +48,7 @@ include("api/statistics.php");
?> ?>
</div> </div>
<h1>Søk opp løper</h1> <h1>Søk opp løper</h1>
<form action="/api/runner.php" method="GET" hx-boost="true" hx-target="#runner" hx-swap="show:none" hx-headers='js:{"Password": localStorage.getItem("passord")}'> <form action="/api/runner.php" method="GET" hx-boost="true" hx-target="#runner" hx-swap="show:none">
<label> <label>
Navn, startnummer eller klubb Navn, startnummer eller klubb
<input type="text" name="search" id="search"> <input type="text" name="search" id="search">
@ -57,9 +57,9 @@ include("api/statistics.php");
</form> </form>
<div id="runner" class="profile-card"></div> <div id="runner" class="profile-card"></div>
<button hx-get="/api/email.php" hx-target="#emails" hx-headers='js:{"Password": localStorage.getItem("passord")}'>hent alle eposter</button> <button hx-get="/api/email.php" hx-target="#emails" hx-headers='js:{"password": localStorage.getItem("passord")}'>hent alle eposter</button>
<button hx-get="/api/email.php?course=Kadaverløpet" hx-target="#emails" hx-headers='js:{"Password": localStorage.getItem("passord")}'>Hent bare eposter for fullkadavern</button> <button hx-get="/api/email.php?course=Kadaverløpet" hx-target="#emails" hx-headers='js:{"password": localStorage.getItem("passord")}'>Hent bare eposter for fullkadavern</button>
<button hx-get="/api/email.php?course=Minikadaver'n" hx-target="#emails" hx-headers='js:{"Password": localStorage.getItem("passord")}'>Hent bare eposter for minikadaver'n</button> <button hx-get="/api/email.php?course=Minikadaver'n" hx-target="#emails" hx-headers='js:{"password": localStorage.getItem("passord")}'>Hent bare eposter for minikadaver'n</button>
<div class="flash default"> <div class="flash default">
<output id="emails"></output> <output id="emails"></output>
</div> </div>

View File

@ -18,15 +18,12 @@ function write_ini_file($assoc_array, $path) {
$config = parse_ini_file("$documentRoot/data/config.ini"); $config = parse_ini_file("$documentRoot/data/config.ini");
include("$documentRoot/data/hash.php"); $hash = file_get_contents("$documentRoot/data/hash.txt");
$method = $_SERVER['REQUEST_METHOD']; $method = $_SERVER['REQUEST_METHOD'];
if ($method == "POST") { if ($method == "POST") {
$start_time = $_POST['start_time']; $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"); $new_time = DateTime::createFromFormat(DateTime::ISO8601, $start_time. "+01");
if (!password_verify($password, $hash)) { if (!password_verify($password, $hash)) {
@ -38,30 +35,13 @@ if ($method == "POST") {
$file = "$documentRoot/data/config.ini"; $file = "$documentRoot/data/config.ini";
$config["start_date"] = $start_time . "+01"; $config["start_date"] = $start_time . "+01";
$config["start_date_mini"] = $start_time_mini . "+01";
write_ini_file($config, $file); write_ini_file($config, $file);
header("HX-Replace-Url: false"); header("HX-Replace-Url: false");
echo("Starttida er oppdatert til: $start_time for Kadaver'n <br> $start_time_mini for Minikadaer'n"); echo("Starttida er oppdatert til: $start_time");
} }
} }
elseif ($method == "GET"){ elseif ($method == "GET"){
$start_kadaver = explode("+", $config["start_date"])[0]; print($config["start_date"]);
$start_mini = explode("+", $config["start_date_mini"])[0];
$response = "
<form action='/api/config.php' method='POST' hx-boost='true' hx-target='#updated' hx-swap='show:none' hx-headers='js:{\"Password\": localStorage.getItem(\"passord\")}'>
<label>
Starttid Kadaverløpet
<input type='datetime-local' id='start_time' name='start_time' step='1' value='$start_kadaver'>
</label>
<label>
Starttid Minikadaver'n
<input type='datetime-local' id='mini_time' name='mini_time' step='1' value='$start_mini'>
</label>
<button type='submit'>Oppdater</button>
</form>
<div id='updated'></div>
";
echo($response);
} }

View File

@ -1,26 +1,25 @@
<?php <?php
$documentRoot = $_SERVER['DOCUMENT_ROOT']; $documentRoot = $_SERVER['DOCUMENT_ROOT'];
include("$documentRoot/import_runners.php"); include("$documentRoot/import_runners.php");
include("$documentRoot/data/hash.php"); $hash = file_get_contents("$documentRoot/data/hash.txt");
$method = $_SERVER['REQUEST_METHOD']; $method = $_SERVER['REQUEST_METHOD'];
if ($method == "GET") { if ($method == "GET") {
parse_str($_SERVER['QUERY_STRING'], $query); parse_str($_SERVER['QUERY_STRING'], $query);
$course = $query['course']; $course = $query['course'];
$password = getallheaders()['Password']; $password = getallheaders()['password'];
if (!password_verify($password, $hash)) { if (!password_verify($password, $hash)) {
http_response_code(response_code: 401); 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);
} }

View File

@ -1,17 +1,18 @@
<?php <?php
$documentRoot = $_SERVER['DOCUMENT_ROOT']; $documentRoot = $_SERVER['DOCUMENT_ROOT'];
include("$documentRoot/data/hash.php"); print_r($documentRoot);
$hash = file_get_contents("$documentRoot/data/hash.txt");
$method = $_SERVER['REQUEST_METHOD']; $method = $_SERVER['REQUEST_METHOD'];
if ($method == "POST") { if ($method == "POST") {
$password = $_POST['password']; $password = $_POST['password'];
if (!password_verify($password, $hash)) { if (!password_verify($password, $hash)) {
http_response_code(response_code: 401); http_response_code(response_code: 401);
} }
else { else {
http_response_code(response_code: 200); http_response_code(response_code: 200);
} }
}else { }
else {
http_response_code(response_code: 405); http_response_code(response_code: 405);
} }

View File

@ -6,7 +6,7 @@ $runner_id = $_POST['id'];
$time = $_POST['time']; $time = $_POST['time'];
$password = $_POST['password']; $password = $_POST['password'];
include("$documentRoot/data/hash.php"); $hash = file_get_contents("$documentRoot/data/hash.txt");
if (!password_verify($password, $hash)) { if (!password_verify($password, $hash)) {
http_response_code(response_code: 401); http_response_code(response_code: 401);

View File

@ -3,7 +3,7 @@ $documentRoot = $_SERVER['DOCUMENT_ROOT'];
include("$documentRoot/import_runners.php"); include("$documentRoot/import_runners.php");
include("$documentRoot/data/hash.php"); $hash = file_get_contents("$documentRoot/data/hash.txt");
$method = $_SERVER['REQUEST_METHOD']; $method = $_SERVER['REQUEST_METHOD'];
if ($method == "POST") { if ($method == "POST") {
$runner_id = $_POST['id']; $runner_id = $_POST['id'];
@ -37,103 +37,91 @@ if ($method == "POST") {
} }
} }
if ($method == "PATCH") { if ($method == "PATCH") {
$password = getallheaders()['Password']; parse_str(file_get_contents('php://input'), $_PATCH);
if (!password_verify($password, $hash)) { $line = $_PATCH["id"] . ";;" . $_PATCH["name"] . ";" . $_PATCH["email"] . ";" . $_PATCH["phone"] . ";" . $_PATCH["club"] . ";" . $_PATCH["course"] . ";;;\n";
http_response_code(response_code: 401);
} else {
parse_str(file_get_contents('php://input'), $_PATCH);
$line = $_PATCH["id"] . ";;" . $_PATCH["name"] . ";" . $_PATCH["email"] . ";" . $_PATCH["phone"] . ";" . $_PATCH["club"] . ";" . $_PATCH["course"] . ";;;\n";
$all_lines = file("$documentRoot/data/db.csv"); $all_lines = file("$documentRoot/data/db.csv");
$csv_line = (int)$_PATCH["line_in_csv"]; $csv_line = (int)$_PATCH["line_in_csv"];
$old_id = str_getcsv($all_lines[$csv_line], ";")[0]; $old_id = str_getcsv($all_lines[$csv_line], ";")[0];
$runners = read_runners_from_csv(); $runners = read_runners_from_csv();
$filtered = search_for_runner($runners, $_PATCH["id"]); $filtered = search_for_runner($runners, $_PATCH["id"]);
if (!is_int($csv_line)){ if (!is_int($csv_line)){
http_response_code(response_code: 400);
} elseif ($filtered != [] && $_PATCH["id"] != $old_id) {
http_response_code(response_code: 400); http_response_code(response_code: 400);
} elseif ($filtered != [] && $_PATCH["id"] != $old_id) { echo("<span class='bg-danger'>Startnummer er allerede i bruk!</span>");
http_response_code(response_code: 400); } else {
echo("<span class='bg-danger'>Startnummer er allerede i bruk!</span>"); $all_lines[$csv_line] = $line;
} else { file_put_contents("$documentRoot/data/db.csv",implode("",$all_lines));
$all_lines[$csv_line] = $line; echo("<span class='bg-success'>Endret: $line</span>");
file_put_contents("$documentRoot/data/db.csv",implode("",$all_lines)); }
echo("<span class='bg-success'>Endret: $line</span>");
}
}
} }
if ($method == "GET") { if ($method == "GET") {
$password = getallheaders()['Password']; parse_str($_SERVER['QUERY_STRING'], $query);
if (!password_verify($password, $hash)) {
http_response_code(response_code: 401); $runners = read_runners_from_csv();
} else { $filtered = search_for_runner($runners, $query['search']);
parse_str($_SERVER['QUERY_STRING'], $query); if (count($filtered) == 1 && $query['edit'] == "true") {
$r = $filtered[0];
$runners = read_runners_from_csv(); $response .= "
$filtered = search_for_runner($runners, $query['search']); <h2>Endre $r->id $r->name</h2>
if (isset($query['get'])) { <form hx-patch='/api/runner.php'>
$filtered = [get_runner($runners,$query['get'])]; <label>Startnummer<input type='number' id='id' name='id' required value='$r->id'></label>
} <label>Navn<input type='text' id='name' name='name' required value='$r->name'></label>
if (count($filtered) == 1 && $query['edit'] == "true") { <label>Forening<input type='text' id='club' name='club' required value='$r->club'></label>
$r = $filtered[0]; <label>
$response .= " <fieldset>
<h2>Endre $r->id $r->name</h2> <input type='radio' name='course' value='Kadaverløpet' checked='checked'>
<form hx-patch='/api/runner.php' hx-headers='js:{\"Password\": localStorage.getItem(\"passord\")}'> Kadaverløpet
<label>Startnummer<input type='number' id='id' name='id' required value='$r->id'></label> </label>
<label>Navn<input type='text' id='name' name='name' required value='$r->name'></label>
<label>Forening<input type='text' id='club' name='club' required value='$r->club'></label>
<label> <label>
<fieldset> <input type='radio' name='course' value=\"Minikadaver'n\">
<input type='radio' name='course' value='Kadaverløpet' checked='checked'> Minikadaver'n
Kadaverløpet </label>
</label> </fieldset>
<label> <label>epost<input type='text' id='email' name='email' value='$r->email'></label>
<input type='radio' name='course' value=\"Minikadaver'n\"> <label>telefon<input type='text' id='phone' name='phone' value='$r->phone'></label>
Minikadaver'n <label><input type='hidden' id='student' name='student' required value='$r->is_student'></label>
</label> <label><input type='hidden' id='line_in_csv' name='line_in_csv' required value='$r->line_in_csv'></label>
</fieldset> <button type='submit'>Endre løper</button>
<label>epost<input type='text' id='email' name='email' value='$r->email'></label> </form>
<label>telefon<input type='text' id='phone' name='phone' value='$r->phone'></label> ";
<label><input type='hidden' id='student' name='student' required value='$r->is_student'></label> header("HX-Replace-Url: false");
<label><input type='hidden' id='line_in_csv' name='line_in_csv' required value='$r->line_in_csv'></label> echo($response);
<button type='submit'>Endre løper</button> } elseif (count($filtered) == 1){
</form> $r = $filtered[0];
"; $response .= "
header("HX-Replace-Url: false"); <h2> $r->name</h2>
echo($response); <p> <b>Klubb:</b> $r->club</p>
} elseif (count($filtered) == 1){ <p> <b>Løype:</b> $r->course</p>
$r = $filtered[0]; <p> <b>Epost:</b> <a href=\"mailto:$r->email\">$r->email</a></p>
$response .= " <p> <b>Mobilnummer:</b> <a href=\"tel:$r->phone\">$r->phone</a></p>
<h2> $r->name</h2> <p> <b>Student?</b> $r->is_student</p>
<p> <b>Klubb:</b> $r->club</p> ";
<p> <b>Løype:</b> $r->course</p> header("HX-Replace-Url: false");
<p> <b>Epost:</b> <a href=\"mailto:$r->email\">$r->email</a></p> echo($response);
<p> <b>Mobilnummer:</b> <a href=\"tel:$r->phone\">$r->phone</a></p>
<p> <b>Student?</b> $r->is_student</p>
";
header("HX-Replace-Url: false");
echo($response);
}
elseif (count($filtered) > 1){
$response = "";
for ($i = 0; $i < count($filtered); $i++) {
$runner = $filtered[$i];
if ($query['edit'] == "true") {
$url = "/api/runner.php?get=$runner->id&edit=true";
} else {
$url = "/api/runner.php?get=$runner->id";
}
$response .= "<button class=\"default\" hx-get=\"$url\" hx-target=\"#runner\" hx-swap=\"show:none\" hx-headers='js:{\"Password\": localStorage.getItem(\"passord\")}'>$runner->id $runner->name</button>";
header("HX-Replace-Url: false");
}
echo($response);
}
else{
echo("Ingen resultater...");
}
} }
elseif (count($filtered) > 1){
$response = "";
for ($i = 0; $i < count($filtered); $i++) {
$runner = $filtered[$i];
if ($query['edit'] == "true") {
$url = "/api/runner.php?search=$runner->id&edit=true";
} else {
$url = "/api/runner.php?search=$runner->id";
}
$response .= "<button class=\"default\" hx-get=\"$url\" hx-target=\"#runner\" hx-swap=\"show:none\">$runner->id $runner->name</button>";
header("HX-Replace-Url: false");
}
echo($response);
}
else{
echo("Ingen resultater...");
}
} }

View File

@ -4,7 +4,6 @@ $documentRoot = $_SERVER['DOCUMENT_ROOT'];
$config = parse_ini_file("$documentRoot/data/config.ini"); $config = parse_ini_file("$documentRoot/data/config.ini");
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
$GLOBALS['start_time'] = DateTime::createFromFormat(DateTime::ISO8601, $config["start_date"]); $GLOBALS['start_time'] = DateTime::createFromFormat(DateTime::ISO8601, $config["start_date"]);
$GLOBALS['start_time_mini'] = DateTime::createFromFormat(DateTime::ISO8601, $config["start_date_mini"]);
$GLOBALS['number_of_controls'] = 3; $GLOBALS['number_of_controls'] = 3;
/* /*
// Caching // Caching
@ -166,9 +165,7 @@ function liveresult_table($runners) {
$matposter = "<td>$tid_1_mat</td><td>$tid_2_mat</td>"; $matposter = "<td>$tid_1_mat</td><td>$tid_2_mat</td>";
} }
if ($runner->course == "Kadaverløpet") { if ($runner->course == "Kadaverløpet") {
$runner_number = $kadaver_num ."."; $kadaver_table .= "<tr><td>". $kadaver_num .".</td><td>$runner->name</td>$matposter<td>$tid_maal</td><td>$tid_etter</td>$sprekk</tr>\n";
if ($runner->get_control() == -1){$runner_number = "";};
$kadaver_table .= "<tr><td>". $runner_number ."</td><td>$runner->name</td>$matposter<td>$tid_maal</td><td>$tid_etter</td>$sprekk</tr>\n";
} }
} }
$kadaver_table .= "</tbody></table>\n"; $kadaver_table .= "</tbody></table>\n";
@ -177,8 +174,8 @@ function liveresult_table($runners) {
} }
function minikadadvern_table($runners) { function minikadadvern_table($runners) {
//usort($runners, "cmp"); usort($runners, "cmp");
//usort($runners, "cmp_course"); usort($runners, "cmp_course");
$minikadaver_table = "<table><thead> $minikadaver_table = "<table><thead>
<tr> <tr>
<th>#</th> <th>#</th>
@ -186,18 +183,53 @@ function minikadadvern_table($runners) {
<th>Mål</th> <th>Mål</th>
</tr></thead> </tr></thead>
<tbody>"; <tbody>";
$mini_num = 0; $kadaver_num = 0;
$mini_num = 0;
for ($i = 0; $i < count($runners); $i++) { for ($i = 0; $i < count($runners); $i++) {
$runner = $runners[$i]; $runner = $runners[$i];
$tid_maal = ""; $tid_maal = "";
$sprekk = "<td></td>";
if ($runner->splits[2] != false) { if ($runner->splits[2] != false) {
$tid_maal = $GLOBALS['start_time_mini']->diff($runner->splits[2])->format('%H:%I:%S'); $tid_maal = $GLOBALS['start_time']->diff($runner->splits[2])->format('%H:%I:%S');
} }
if ($runner->course == "Minikadaver'n") { if ($runner->course == "Kadaverløpet") {
$mini_num++; $kadaver_num++;
$runner_number = $mini_num . "."; $tid_1_mat = "";
if ($runner->get_control() != 2){$runner_number = "";}; if ($runner->splits[0] != false) {
$minikadaver_table .= "<tr><td>". "$runner_number" ."</td><td>$runner->name</td><td>$tid_maal</td></tr>\n"; // https://www.php.net/manual/en/class.dateinterval.php
$tid_1_mat = $GLOBALS['start_time']->diff($runner->splits[0])->format('%H:%I:%S');
}
$tid_2_mat = "";
//tid etter vinner
$tid_etter = "";
if ($runner->splits[2] != false && $kadaver_num > 0) {
$tid_etter = $runners[0]->splits[2]->diff($runner->splits[2])->format('%I:%S');
}
//sprekkindekss
if ($runner->splits[1] != false) {
$tid_2_mat = $GLOBALS['start_time']->diff($runner->splits[1])->format('%H:%I:%S');
try {
$sprekk = "<td>" . number_format(100*(time_diff($GLOBALS['start_time'],$runner->splits[2]) - time_diff($GLOBALS['start_time'],$runner->splits[1])) / time_diff($GLOBALS['start_time'],$runner->splits[2]), 0) . "%</td>";
}
catch (DivisionByZeroError $e){
$sprekk = "<td></td>";
}
catch (TypeError $e) {
$sprekk = "<td></td>";
}
}
$matposter = "<td>$tid_1_mat</td><td>$tid_2_mat</td>";
}
else {
$mini_num++;
}
if ($runner->course == "Kadaverløpet") {
$kadaver_table .= "<tr><td>". $kadaver_num .".</td><td>$runner->name</td>$matposter<td>$tid_maal</td><td>$tid_etter</td>$sprekk</tr>\n";
}
elseif ($runner->course == "Minikadaver'n") {
$minikadaver_table .= "<tr><td>". "" .".</td><td>$runner->name</td><td>$tid_maal</td></tr>\n";
} }
} }
$minikadaver_table .= "</tbody></table>"; $minikadaver_table .= "</tbody></table>";

View File

@ -19,17 +19,26 @@
<li class="disabled"><a href="/registrering.php">⏱️ Registrer passering på matpost/mål</a></li> <li class="disabled"><a href="/registrering.php">⏱️ Registrer passering på matpost/mål</a></li>
<li class="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li> <li class="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li>
<li class="selected"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li> <li class="selected"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
<li class="disabled">⏳️ Nedtelling matpost <li class="selected">⏳️ Nedtelling matpost
<menu> <menu>
<li><a href="/matpost_nedtelling.php?matpost=0">1. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=0">1. mat</a></li>
<li><a href="/matpost_nedtelling.php?matpost=1">2. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=1">2. mat</a></li>
</menu> </menu>
</li> </li>
</menu> </menu>
</nav> </nav>
<h2>Sett dato og tid startskuddet gikk:</h2> <h2>Sett dato og tid startskuddet gikk:</h2>
<div hx-get="/api/config.php" hx-swap="outerHTML" hx-trigger="load"></div> <form action="/api/config.php" method="POST" hx-boost="true" hx-target="#updated" hx-swap="show:none">
<input style="display: none;" type="text" id="password" name="password" required>
<label>
Dato og tid
<input type="datetime-local" id="start_time" name="start_time" step="1">
</label>
<button type="submit">Oppdater</button>
</form>
<div id="updated"></div>
</div>
<script> <script>
function log_out(){ function log_out(){
localStorage.removeItem("navn"); localStorage.removeItem("navn");

View File

@ -19,16 +19,16 @@
<li class="disabled"><a href="/registrering.php">⏱️ Registrer passering på matpost/mål</a></li> <li class="disabled"><a href="/registrering.php">⏱️ Registrer passering på matpost/mål</a></li>
<li class="selected"><a href="/db_editor.html">👥 Endre løperbase</a></li> <li class="selected"><a href="/db_editor.html">👥 Endre løperbase</a></li>
<li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li> <li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
<li class="disabled">⏳️ Nedtelling matpost <li class="selected">⏳️ Nedtelling matpost
<menu> <menu>
<li><a href="/matpost_nedtelling.php?matpost=0">1. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=0">1. mat</a></li>
<li><a href="/matpost_nedtelling.php?matpost=1">2. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=1">2. mat</a></li>
</menu> </menu>
</li> </li>
</menu> </menu>
</nav> </nav>
<h2>Legg til løper</h2> <h2>Legg til løper</h2>
<form action="/api/runner.php" method="POST" hx-boost="true" hx-target="#updated" hx-swap="show:none" hx-headers='js:{"Password": localStorage.getItem("passord")}'> <form action="/api/runner.php" method="POST" hx-boost="true" hx-target="#updated" hx-swap="show:none">
<input style="display: none;" type="text" id="password" name="password" required> <input style="display: none;" type="text" id="password" name="password" required>
<label for="id">Startnummer: <label for="id">Startnummer:
@ -56,7 +56,7 @@
</form> </form>
<div id="updated"></div> <div id="updated"></div>
<h2>Endre løper</h2> <h2>Endre løper</h2>
<form action="/api/runner.php" method="GET" hx-boost="true" hx-target="#runner" hx-swap="show:none" hx-headers='js:{"Password": localStorage.getItem("passord")}'> <form action="/api/runner.php" method="GET" hx-boost="true" hx-target="#runner" hx-swap="show:none">
<input type="hidden" id="edit" name="edit" value="true"> <input type="hidden" id="edit" name="edit" value="true">
<label> <label>
Søk etter navn, startnummer eller klubb Søk etter navn, startnummer eller klubb

View File

@ -34,17 +34,13 @@ class Runner
} }
function get_control(){ function get_control(){
if ($this->splits[2] != false) { $control = -1;
return 2; for ($i = 0; $i < count($this->splits); $i++) {
} elseif ($this->splits[1] != false) { if ($this->splits[$i] != false) {
return 1; $control++;
} }
elseif ($this->splits[0] != false) {
return 0;
}
else {
return -1;
} }
return $control;
} }
} }

View File

@ -50,8 +50,8 @@
<li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li> <li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
<li class="selected">⏳️ Nedtelling matpost <li class="selected">⏳️ Nedtelling matpost
<menu> <menu>
<li><a href="/matpost_nedtelling.php?matpost=0">1. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=0">1. mat</a></li>
<li><a href="/matpost_nedtelling.php?matpost=1">2. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=1">2. mat</a></li>
</menu> </menu>
</li> </li>
</menu> </menu>

View File

@ -20,6 +20,7 @@
<h1>Påmeldte Kadaverløpet 2025</h1> <h1>Påmeldte Kadaverløpet 2025</h1>
</div> </div>
<h2>Oppdatert 28.10.25</h2> <h2>Oppdatert 28.10.25</h2>
<div class="flash attention">Startnummer blir tildelt nærmere arrangementet. Prøver å oppdatere lista jevnlig. TBN</div>
<?php <?php
$query = ["type"=>"paameldte"]; $query = ["type"=>"paameldte"];
include("api/table.php"); include("api/table.php");

View File

@ -53,10 +53,10 @@
<li class="selected"><a href="/registrering.php">⏱️ Registrer passering matpost/mål</a></li> <li class="selected"><a href="/registrering.php">⏱️ Registrer passering matpost/mål</a></li>
<li class="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li> <li class="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li>
<li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li> <li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
<li class="disabled">⏳️ Nedtelling matpost <li class="selected">⏳️ Nedtelling matpost
<menu> <menu>
<li><a href="/matpost_nedtelling.php?matpost=0">1. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=0">1. mat</a></li>
<li><a href="/matpost_nedtelling.php?matpost=1">2. mat</a></li> <li><a href="http://localhost:8000/matpost_nedtelling.php?matpost=1">2. mat</a></li>
</menu> </menu>
</li> </li>
</menu> </menu>