Flytta endepunkter inn i api/

This commit is contained in:
Trygve
2025-10-28 21:44:08 +01:00
parent 604fb365c6
commit 4cc7ff821c
14 changed files with 45 additions and 34 deletions

19
api/passing.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
$control = $_POST['control'];
$runner_id = $_POST['id'];
$time = $_POST['time'];
$password = $_POST['password'];
$hash = file_get_contents("$documentRoot/data/hash.txt");
if (!password_verify($password, $hash)) {
http_response_code(response_code: 401);
}
else {
$file = "$documentRoot/data/passering.csv";
$current = file_get_contents($file);
$current .= $control . "," . $runner_id . "," . $time . "\n";
file_put_contents($file, $current);
}