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>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -47,13 +66,6 @@ $config_data = json_decode($raw_json_config, false);
|
|||||||
|
|
||||||
<?php
|
<?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;
|
endif;
|
||||||
|
|
||||||
if ($login):
|
if ($login):
|
||||||
@ -96,17 +108,8 @@ $config_data = json_decode($raw_json_config, false);
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (null !== $_POST['pwd']) {
|
endif;
|
||||||
$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; ?>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
11
owe.js
11
owe.js
@ -31,11 +31,14 @@ function loadSentences(alertIfNew = false, increaseUnread = true) {
|
|||||||
|
|
||||||
// color
|
// color
|
||||||
var spans = document.querySelector(".sentences").getElementsByTagName("span");
|
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();
|
initializeLoginArea();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user