Compare commits
2 Commits
40fc554954
...
82a487d3dd
| Author | SHA1 | Date | |
|---|---|---|---|
| 82a487d3dd | |||
| 69753dac66 |
39
admin.php
39
admin.php
@ -1,3 +1,22 @@
|
||||
<?php
|
||||
if (null !== $_POST['set_pwd']) {
|
||||
$pwd = $_POST['set_pwd'];
|
||||
file_put_contents('data/admin_pwd', password_hash($pwd, PASSWORD_DEFAULT));
|
||||
setcookie('owe_admin', base64_encode($pwd), ['httponly' => true]);
|
||||
header('location: admin.php');
|
||||
} elseif (null !== $_POST['pwd']) {
|
||||
$pwd = $_POST['pwd'];
|
||||
if (password_verify($pwd, file_get_contents('data/admin_pwd'))) {
|
||||
setcookie('owe_admin', base64_encode($pwd), ['httponly' => true]);
|
||||
header('location: admin.php');
|
||||
print("DER KEKS MÜSSTE GESETZT SEIN");
|
||||
} else {
|
||||
print("Nope, falsch");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<?php
|
||||
@ -47,13 +66,6 @@ $config_data = json_decode($raw_json_config, false);
|
||||
|
||||
<?php
|
||||
|
||||
if (null !== $_POST['set_pwd']) {
|
||||
$pwd = $_POST['set_pwd'];
|
||||
file_put_contents('data/admin_pwd', password_hash($pwd, PASSWORD_DEFAULT));
|
||||
setcookie('owe_admin', base64_encode($pwd), ['httponly' => true]);
|
||||
header('location: admin.php');
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if ($login):
|
||||
@ -96,17 +108,8 @@ $config_data = json_decode($raw_json_config, false);
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if (null !== $_POST['pwd']) {
|
||||
$pwd = $_POST['pwd'];
|
||||
if (password_verify($pwd, file_get_contents('data/admin_pwd'))) {
|
||||
setcookie('owe_admin', base64_encode($pwd), ['httponly' => true]);
|
||||
header('location: admin.php');
|
||||
} else {
|
||||
print("Nope, falsch");
|
||||
}
|
||||
}
|
||||
|
||||
endif; ?>
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
|
||||
11
owe.js
11
owe.js
@ -31,11 +31,14 @@ function loadSentences(alertIfNew = false, increaseUnread = true) {
|
||||
|
||||
// color
|
||||
var spans = document.querySelector(".sentences").getElementsByTagName("span");
|
||||
// we expect this to be from the user who's turn it is now
|
||||
var histurnspan = spans[spans.length - config_data.users.length];
|
||||
//console.log(histurnspan.getAttribute("style"));
|
||||
document.getElementById("wordinput").setAttribute("style", histurnspan.getAttribute("style"));
|
||||
|
||||
if (spans.length >= config_data.users.length) {
|
||||
var histurnspan = spans[spans.length - config_data.users.length];
|
||||
//console.log(histurnspan.getAttribute("style"));
|
||||
document.getElementById("wordinput").setAttribute("style", histurnspan.getAttribute("style"));
|
||||
} else {
|
||||
console.error('Not enough spans available for users.');
|
||||
}
|
||||
initializeLoginArea();
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user