From 3d09077fe23132a4ff72895bf0d505859ae66416 Mon Sep 17 00:00:00 2001 From: nilsding Date: Mon, 18 Aug 2014 15:07:41 +0200 Subject: [PATCH] added a flash and also some basic UCP code --- config.php | 8 ++++++++ ucp.php | 43 +++++++++++++++++++++++++++++++++++++++++++ views/inbox.html | 3 +++ views/index.html | 3 +++ views/login.html | 3 +++ views/settings.html | 3 +++ 6 files changed, 63 insertions(+) diff --git a/config.php b/config.php index ca7f129..7203949 100644 --- a/config.php +++ b/config.php @@ -68,8 +68,16 @@ if (!isset($notemplate)) { $res = $sql->query("SELECT `value` FROM `config` WHERE `key` = \"sitename\";")->fetch_assoc(); $site_name = htmlspecialchars($res['value']); + // the flash + $message = null; + if (isset($_SESSION['flash'])) { + $message = $_SESSION['flash']; + unset($_SESSION['flash']); + } + $tpl->assign("logged_in", $_SESSION['logged_in']); $tpl->assign("site_name", $site_name); $tpl->assign("words_total", $words_total_count); $tpl->assign("inbox_count", $new_words_count); + $tpl->assign("message", $message); } \ No newline at end of file diff --git a/ucp.php b/ucp.php index e69de29..528efa4 100644 --- a/ucp.php +++ b/ucp.php @@ -0,0 +1,43 @@ + + * + * Oh, and before I forget... + * ________ __________ __ ____ __ ______ + * / ____/ / / / ____/ //_/ / __ \/ / / / __ \ + * / /_ / / / / / / ,< / /_/ / /_/ / /_/ / with + * / __/ / /_/ / /___/ /| | / ____/ __ / ____/ a + * /_/ \____/\____/_/ |_| /_/ /_/ /_/_/ cactus! + * + * Thanks for listening. + */ + +include_once 'config.php'; + +switch ($_GET['page']) { + case "login": { + $tpl->draw("login"); + break; + } + case "logout": { + session_destroy(); + session_start(); + $_SESSION['flash'] = "Sucessfully logged out"; + header('Location: index.php'); + break; + } + case "settings": { + $tpl->draw("settings"); + break; + } + case "inbox": + default: { + $tpl->draw("inbox"); + } +} \ No newline at end of file diff --git a/views/inbox.html b/views/inbox.html index 7aa1a0f..3da583c 100644 --- a/views/inbox.html +++ b/views/inbox.html @@ -1,6 +1,9 @@ {include="layout"} {include="navbar"}
+{if="$message"} +
{$message}
+{/if}