diff --git a/assets/common/styles.css b/assets/common/styles.css
index 8148a78..58cbadc 100755
--- a/assets/common/styles.css
+++ b/assets/common/styles.css
@@ -116,6 +116,10 @@ ul {
display: block;
}
+#header table {
+ width: 100%;
+}
+
#footer {
border-top: double;
padding: 1em;
@@ -123,7 +127,6 @@ ul {
.noborder-table td, .noborder-table th {
border: none;
- text-align: left;
}
.image-container-right {
diff --git a/docs/common/header.php b/docs/common/header.php
index 2d3a369..16e2a41 100755
--- a/docs/common/header.php
+++ b/docs/common/header.php
@@ -40,6 +40,45 @@ function attempt_sql_connect() {
}
}
+/**
+ * If user logged out, destroy the session data and delete cookie.
+ */
+if (isset($_POST["logout"])) {
+ if (ini_get("session.use_cookies")) {
+ $params = session_get_cookie_params();
+ setcookie(session_name(), '', time() - 42000,
+ $params["path"], $params["domain"],
+ $params["secure"], $params["httponly"]
+ );
+ }
+
+ // Redirect to this page with GET
+ header(sprintf("Location: %s?%s", sanitize_input($_SERVER["PHP_SELF"]),
+ sanitize_input($_POST["get_params"])));
+}
+
+/**
+ * Construct the available account actions for the header depending on whether
+ * a user is logged in or not and return it as string.
+ */
+function construct_account_section(){
+ if(isset($_SESSION["current_user"])) {
+ return sprintf("Logged in as %s
+
+
+ Delete account", $_SESSION["current_user"]->user_name,
+ sanitize_input($_SERVER["PHP_SELF"]),
+ sanitize_input($_SERVER["QUERY_STRING"]));
+ }
+ else {
+ return sprintf("Login
+
Register");
+ }
+}
+
/**
* Start the html document, set headers, begin body and display the default
* navbar.
@@ -62,7 +101,16 @@ function display_header($pageTitle) {
", $pageTitle);
+ ", $pageTitle, construct_account_section());
}
?>
diff --git a/docs/www/blog/article.php b/docs/www/blog/article.php
index 8b129d1..c5a2ad0 100644
--- a/docs/www/blog/article.php
+++ b/docs/www/blog/article.php
@@ -403,7 +403,7 @@ $blogPost = load_blog($conn, $blogId);
// If no ID was entered, display warning and die.
if(!$blogPost) {
-display_header("Article not found");
+ display_header("Article not found");
printf("
The article you requested doesn't exist.