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! +