Lagde config fil og side for å endre starttidspunkt
This commit is contained in:
55
config_editor.html
Normal file
55
config_editor.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!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">
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<menu>
|
||||
<li class="disabled"><a href="/admin.php">📊 Dashbord</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="selected"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
|
||||
</menu>
|
||||
</nav>
|
||||
|
||||
<h2>Sett dato og tid startskuddet gikk:</h2>
|
||||
<form action="/config.php" method="POST">
|
||||
<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>
|
||||
<script>
|
||||
function log_out(){
|
||||
localStorage.removeItem("navn");
|
||||
localStorage.removeItem("passord");
|
||||
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")
|
||||
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");
|
||||
|
||||
xmlHttpReq.open("GET", "/config.php", false);
|
||||
xmlHttpReq.send();
|
||||
document.getElementById('start_time').value = xmlHttpReq.response.split('+')[0]
|
||||
console.log(xmlHttpReq.response)
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user