Oppdrydning

This commit is contained in:
Trygve 2025-10-27 12:04:10 +01:00
parent 91451b382f
commit 648bb5443c
4 changed files with 47 additions and 64 deletions

View File

@ -6,25 +6,6 @@
<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>
<nav>
@ -35,19 +16,6 @@
</menu>
</nav>
<button class="danger" onclick="log_out()">Logg ut</button>
<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>
<script>

View File

@ -6,25 +6,6 @@
<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>
<nav>
@ -34,16 +15,31 @@
<li class="selected"><a href="/db_editor.html">Endre løperbase</a></li>
</menu>
</nav>
<h2>Simple Form</h2>
<h2>Legg til løper</h2>
<form action="/runner.php" method="POST">
<label for="password">Passord:</label><br>
<input type="text" id="password" name="password" required><br><br>
<input style="display: none;" type="text" id="password" name="password" required>
<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>
<label for="id">Startnummer:
<input type="text" id="id" name="id" required>
</label>
<label for="navn">Navn:
<input type="text" id="name" name="name">
</label>
<label for="club">Klubb:
<input type="text" id="club" name="club">
</label>
<fieldset>
<legend>Klasse</legend>
<label>
<input type="radio" name="course" value="Kadaverløpet" checked="checked">
Kadaverløpet
</label>
<label>
<input type="radio" name="course" value="Minikadaver'n">
Minikadaver'n
</label>
</fieldset>
<button type="submit">Submit</button>
</form>
@ -56,6 +52,7 @@
window.location.href = "/login.html";
}
// Sjekk om brukeren er logga inn. hvis ikke hiv de ut til innloggingskjermen
let xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.open("POST", "/is_authorized.php", false);
xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
@ -63,6 +60,7 @@
if (xmlHttpReq.status != 200){
window.location.href = "/login.html";
}
document.getElementById('password').value = localStorage.getItem("passord");
</script>
</body>

View File

@ -27,9 +27,14 @@
</style>
</head>
<body>
<div class="settings">
<legend>Passord</legend>
<input type="password" name="passord" id="password">
<div class="settings">
<nav>
<menu>
<li class="disabled"><a href="/admin.php">Dashbord</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>
</menu>
</nav>
<fieldset>
<legend>Velg post</legend>
<label>
@ -72,7 +77,7 @@ function register_runner(id) {
return 0;
}
let formData = new FormData();
formData.append(name= 'password', value=document.getElementById('password').value)
formData.append(name= 'password', localStorage.getItem("passord"))
formData.append(name= 'control', value=control);
formData.append(name= 'id', value=id);
time = new Date(Date.now()).toISOString().split('.')[0]+"Z"
@ -99,6 +104,18 @@ function update() {
.then((response) => response.text())
.then((text) => {table.innerHTML = text;})
}
// Sjekk om brukeren er logga inn. hvis ikke hiv de ut til innloggingskjermen
let xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.open("POST", "/is_authorized.php", false);
xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
xmlHttpReq.send("username=" + localStorage.getItem("navn")+"&"+"password=" + localStorage.getItem("passord"));
if (xmlHttpReq.status != 200){
window.location.href = "/login.html";
}
document.getElementById('password').value = localStorage.getItem("passord");
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@ if ($method == "POST") {
$club = $_POST['club'];
$course = $_POST['course'];
$line = $runner_id . ";;" . $name . ";;;" . $club . ";" . $course;
$line = $runner_id . ";;" . $name . ";;;" . $club . ";" . $course . "\n";
$password = $_POST['password'];
if (!password_verify($password, $hash)) {