logout working (idk how)

This commit is contained in:
Paul Eisenbock 2026-02-12 19:26:16 +01:00
parent fdda46656c
commit 1432598160
3 changed files with 48 additions and 0 deletions

View File

@ -104,12 +104,20 @@ include 'header.php';
</div> </div>
</form> </form>
</div> </div>
<div class="auth__card"> <div class="auth__card">
<form> <form>
<a href="productAdder.php" class="auth__actions"> <br> <a href="productAdder.php" class="auth__actions"> <br>
<button class="auth__submit" type="button"">Produkt hinzufügen</button> <button class="auth__submit" type="button"">Produkt hinzufügen</button>
</a> </a>
</form> </form>
<form action="logout.php" method="post" class="auth__actions" style="margin-top: 20px;">
<button class="auth__submit" type="submit" style="background:#dc2626;">
Abmelden
</button>
</form>
</div> </div>
</section> </section>
</main> </main>

View File

@ -289,6 +289,16 @@
color: var(--gh-text); color: var(--gh-text);
} }
.auth__submit {
transition: 0.2s ease;
}
.auth__submit:hover {
transform: translateY(-2px);
opacity: 0.9;
}
@media (max-width: 900px) { @media (max-width: 900px) {
.auth__grid { .auth__grid {
grid-template-columns: 1fr; grid-template-columns: 1fr;

30
logout.php Normal file
View File

@ -0,0 +1,30 @@
<?php
session_start();
/* Alle Session-Variablen löschen */
$_SESSION = [];
/* Session-Cookie löschen (wichtig!) */
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(
session_name(),
'',
time() - 42000,
$params["path"],
$params["domain"],
$params["secure"],
$params["httponly"]
);
}
/* Session zerstören */
session_destroy();
/* Optional: Remember-Me Cookie löschen (falls vorhanden)
setcookie("remember_token", "", time() - 3600, "/");
*/
header("Location: login.php");
exit();