Starta på admin.php

This commit is contained in:
Trygve 2025-10-26 23:30:11 +01:00
parent d408d18de5
commit 52b20828b7
4 changed files with 78 additions and 5 deletions

46
admin.php Normal file
View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="UTF-8" />
<title>EKT</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Elektronisk Kadaver Tidtakningssystem" />
<link rel="stylesheet" href="matcha.css">
<style>
body {
padding: 0;
}
.settings {
padding: 0 1.5rem;
}
fieldset {
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.bg-success {
background: var(--bg-success) !important;
}
.bg-active {
background: var(--bg-active) !important;
}
</style>
</head>
<body>
<h2>Simple Form</h2>
<form action="/runner.php" method="POST">
<label for="password">Passord:</label><br>
<input type="text" id="password" name="password" required><br><br>
<label for="id">Startnummer:</label><br>
<input type="text" id="id" name="id" required><br><br>
<label for="navn">Navn:</label><br>
<input type="text" id="name" name="input2"><br><br>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>

View File

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

26
runner.php Normal file
View File

@ -0,0 +1,26 @@
<?php
$hash = file_get_contents("hash.txt");
$method = $_SERVER['REQUEST_METHOD'];
print_r($_POST);
if ($method == "POST") {
$runner_id = $_POST['id'];
$name = $_POST['name'];
$club = $_POST['club'];
$course = $_POST['course'];
$line = $runner_id . ";;" . $name . ";;;" . $club . ";" . $course;
$password = $_POST['password'];
if (!password_verify($password, $hash)) {
http_response_code(response_code: 401);
}
elseif (!ctype_digit($runner_id)){
http_response_code(response_code: 400);
}
else {
$file = 'db.csv';
file_put_contents($file, $line, FILE_APPEND);
}
}

View File

@ -1,8 +1,8 @@
<?php
date_default_timezone_set('UTC');
$GLOBALS['start_time'] = DateTime::createFromFormat(DateTime::ISO8601, "2024-11-02T08:53:00+01");
$GLOBALS['start_time'] = DateTime::createFromFormat(DateTime::ISO8601, "2026-10-26T08:53:00+01");
$GLOBALS['number_of_controls'] = 3;
/*
// Caching
header("Last-Modified: " . date("F d Y H:i:s.", filemtime("passering.csv")));
$etag = '"' . md5_file("passering.csv"). '"';
@ -16,7 +16,7 @@ if(isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
exit();
}
}
*/
class Runner
{
public int $id;
@ -137,6 +137,7 @@ for ($i = 0; $i < count($timings); $i++) {
}
function registration_table($runners) {
parse_str($_SERVER['QUERY_STRING'], $query);
$matpost = $query["control"];
$runners_filtered = [];
if ($query["filter"]) {
@ -288,7 +289,7 @@ function liveresult_table($runners) {
}
if (!isset($query)){
//parse_str($_SERVER['QUERY_STRING'], $query);
parse_str($_SERVER['QUERY_STRING'], $query);
if ($query["type"] == "registrering"){
registration_table($runners);
}