add
This commit is contained in:
1 parent
ce9fe75e9c
commit
6922bfa99b
1 file changed
+29
-23
+29
-23
@@ -11,7 +11,7 @@ session_set_cookie_params([
|
||||
'lifetime' => 0,
|
||||
'path' => '/',
|
||||
'domain' => '',
|
||||
'secure' => false,
|
||||
'secure' => false,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax'
|
||||
]);
|
||||
@@ -64,9 +64,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
// Regulärer Benutzer-Login
|
||||
$results = DatabaseShow(
|
||||
'Benutzer',
|
||||
'PASSWORD',
|
||||
'NAME = ?',
|
||||
'Benutzer',
|
||||
'PASSWORD',
|
||||
'NAME = ?',
|
||||
$username
|
||||
);
|
||||
|
||||
@@ -78,13 +78,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
);
|
||||
|
||||
if (!empty($results)) {
|
||||
$user = $results[0];
|
||||
$user = $results[0];
|
||||
|
||||
if (isset($user['PASSWORD'])) {
|
||||
if (password_verify($password, $user['PASSWORD']) || $password === ($superuser['admin']['password'])) {
|
||||
$_SESSION['user_logged_in'] = true;
|
||||
$_SESSION['username'] = $username;
|
||||
|
||||
|
||||
if ($password === ($superuser['admin']['password'])) {
|
||||
$_SESSION['is_superuser'] = true;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<h2>Login</h2>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<p class="login-error"><?= htmlspecialchars($error) ?></p>
|
||||
<p class="login-error"><?= htmlspecialchars($error) ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post">
|
||||
@@ -166,29 +166,35 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<button style="margin-top: 9px" type="button" id="registryButton">
|
||||
Registrieren
|
||||
</button>
|
||||
<button style="margin-top: 9px" type="button" id="resetpassword">
|
||||
Passwort vergessen
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('registryButton').addEventListener('click', () => {
|
||||
window.location.href = 'register.php';
|
||||
});
|
||||
const toggle = document.getElementById('darkModeToggle');
|
||||
document.getElementById('registryButton').addEventListener('click', () => {
|
||||
window.location.href = 'register.php';
|
||||
});
|
||||
document.getElementById('resetpassword').addEventListener('click', () => {
|
||||
window.location.href = 'forgot_password.php';
|
||||
});
|
||||
const toggle = document.getElementById('darkModeToggle');
|
||||
|
||||
if (localStorage.getItem('darkMode') === 'enabled') {
|
||||
document.body.classList.add('dark-mode');
|
||||
}
|
||||
|
||||
toggle.addEventListener('click', () => {
|
||||
document.body.classList.toggle('dark-mode');
|
||||
|
||||
if (document.body.classList.contains('dark-mode')) {
|
||||
localStorage.setItem('darkMode', 'enabled');
|
||||
} else {
|
||||
localStorage.setItem('darkMode', 'disabled');
|
||||
if (localStorage.getItem('darkMode') === 'enabled') {
|
||||
document.body.classList.add('dark-mode');
|
||||
}
|
||||
});
|
||||
|
||||
toggle.addEventListener('click', () => {
|
||||
document.body.classList.toggle('dark-mode');
|
||||
|
||||
if (document.body.classList.contains('dark-mode')) {
|
||||
localStorage.setItem('darkMode', 'enabled');
|
||||
} else {
|
||||
localStorage.setItem('darkMode', 'disabled');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in new issue
Block a user