navbar logout mit post

This commit is contained in:
2026-07-19 14:59:45 +02:00
parent ad9a00fd49
commit bfb2d2b0d8
2 changed files with 33 additions and 5 deletions
+20
View File
@@ -285,6 +285,26 @@ CSS für die navbar
border-bottom: 1px solid #333d43; border-bottom: 1px solid #333d43;
} }
.nav__logout-form {
margin: 0;
}
.nav__mobile-logout-button {
color: #fff;
text-decoration: none;
font-size: 1.2rem;
font-weight: 600;
display: block;
width: 100%;
text-align: left;
padding: 0.5rem 1rem;
border: none;
border-bottom: 1px solid #333d43;
background: none;
cursor: pointer;
font-family: inherit;
}
.nav__mobile-submenu { .nav__mobile-submenu {
display: block; display: block;
list-style: none; list-style: none;
+11 -3
View File
@@ -28,7 +28,12 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
<?php if (isset($_SESSION['user'])): ?> <?php if (isset($_SESSION['user'])): ?>
<li><a href="index.php?pfad=profile">Profil</a></li> <li><a href="index.php?pfad=profile">Profil</a></li>
<li><a href="index.php?pfad=logout">Abmelden</a></li> <li>
<form method="post" action="php/controller/logout-controller.php" class="nav__logout-form">
<?php csrf_field(); ?>
<button type="submit" class="nav__mobile-logout-button">Abmelden</button>
</form>
</li>
<li><a href="index.php?pfad=createArticle">Beitrag erstellen</a></li> <li><a href="index.php?pfad=createArticle">Beitrag erstellen</a></li>
<?php else: ?> <?php else: ?>
@@ -158,9 +163,12 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
Beitrag erstellen Beitrag erstellen
</a> </a>
<a href="index.php?pfad=logout" class="nav__item nav__button"> <form method="post" action="php/controller/logout-controller.php" class="nav__logout-form">
<?php csrf_field(); ?>
<button type="submit" class="nav__item nav__button">
Abmelden Abmelden
</a> </button>
</form>
<?php else: ?> <?php else: ?>