fix admin login
This commit is contained in:
parent
40fc554954
commit
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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user