From 637082442f2e9924a75207f856eadfafa8b62433 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 22 Feb 2013 03:30:05 +0100 Subject: [PATCH] Add logout page --- public_html/modules/logout.php | 31 +++++++++++++++++++++++++++++++ public_html/rewrite.php | 1 + public_html/templates/logout.tpl | 5 +++++ 3 files changed, 37 insertions(+) create mode 100644 public_html/modules/logout.php create mode 100644 public_html/templates/logout.tpl diff --git a/public_html/modules/logout.php b/public_html/modules/logout.php new file mode 100644 index 0000000..3138067 --- /dev/null +++ b/public_html/modules/logout.php @@ -0,0 +1,31 @@ +uParameters[1]; + +if(!empty($_SESSION['logout_key']) && $_SESSION['logout_key'] == $uLogoutKey) +{ + unset($_SESSION['user_id']); + unset($_SESSION['logout_key']); + + $sPageTitle = "Logged out"; + $sPageContents = NewTemplater::Render("logout", $locale->strings, array()); + + NewTemplater::SetGlobalVariable("logged-in", false); +} +else +{ + throw new RouterException("No valid logout key specified."); +} diff --git a/public_html/rewrite.php b/public_html/rewrite.php index 452a223..0056a4b 100644 --- a/public_html/rewrite.php +++ b/public_html/rewrite.php @@ -30,6 +30,7 @@ $router->routes = array( ), "^/sign-up$" => "modules/signup.php", "^/login$" => "modules/login.php", + "^/logout/([a-zA-Z0-9]+)$" => "modules/logout.php", "^/confirm/(.+)/([a-zA-Z0-9]+)" => "modules/confirm.php", "^/dashboard" => "modules/dashboard.php", "^/campaign/([a-zA-Z0-9-]+)$" => "modules/landing.php", diff --git a/public_html/templates/logout.tpl b/public_html/templates/logout.tpl new file mode 100644 index 0000000..83f4a70 --- /dev/null +++ b/public_html/templates/logout.tpl @@ -0,0 +1,5 @@ +

You've been logged out.

+ +

+ Thanks for using ReDonate! +