aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/footer.css8
-rw-r--r--public/footer.php7
-rw-r--r--public/logout.php9
3 files changed, 18 insertions, 6 deletions
diff --git a/public/footer.css b/public/footer.css
index 0483da2..7d0360f 100644
--- a/public/footer.css
+++ b/public/footer.css
@@ -1,12 +1,8 @@
-footer {
- margin-top: 48px;
-}
+footer { margin-top: 96px; }
footer .flex {
display: flex;
justify-content: space-between;
}
-footer .flex * {
- margin: 20px 0;
-}
+footer .inner { margin: 20px auto; }
diff --git a/public/footer.php b/public/footer.php
index 57831be..d42bef5 100644
--- a/public/footer.php
+++ b/public/footer.php
@@ -1,8 +1,15 @@
+<?php require_once "../lib/login.php" ?>
<footer>
<div class="inner limwidth">
<div class="flex">
<span class="left">de winkel website</span>
<span class="right">dit is een footer hoor</span>
</div>
+ <?php if ($logged_in) echo <<<"EOF"
+ <div class="flex">
+ <span class="left"></span>
+ <span class="right"><a href="/logout.php">LAAT ME ERUIT</a></span>
+ </div>
+ EOF; ?>
</div>
</footer>
diff --git a/public/logout.php b/public/logout.php
new file mode 100644
index 0000000..094ee22
--- /dev/null
+++ b/public/logout.php
@@ -0,0 +1,9 @@
+<?php
+$prev = $_COOKIE['prev'];
+if (!$prev) $prev = "/";
+http_response_code(302);
+setcookie("prev", null, -1, "/");
+setcookie("username", null, -1, "/");
+setcookie("password", null, -1, "/");
+header("Location: ".$prev);
+?>