From 2036626b560f22efd59673187a2de3b1319fcf8a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Sep 2014 10:26:56 +0200 Subject: version 4.0 --- bootstrap/functions.php | 382 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 361 insertions(+), 21 deletions(-) (limited to 'bootstrap/functions.php') diff --git a/bootstrap/functions.php b/bootstrap/functions.php index 60408a2..3e937d2 100644 --- a/bootstrap/functions.php +++ b/bootstrap/functions.php @@ -1,5 +1,18 @@ isLoggedIn() != 1){ + redirect("login&goto=".$goto); + } +} + +function redirect($goto){ + header($_SERVER["SERVER_PROTOCOL"] . " 302 Moved"); + header("Location: /?page=".$goto); + ob_clean(); + exit; +} function failure($reason, $httpcode, $ajax = true, $heading = NULL){ # send header with $httpcode @@ -23,31 +36,56 @@ function failure($reason, $httpcode, $ajax = true, $heading = NULL){ exit; } -function print_login(){ +function print_login($option = false){ if(isset($_GET["goto"]) && $_GET["goto"] != "") - $goto = $_GET["goto"]; + $goto = htmlentities($_GET["goto"]); else $goto = "index"; + + global $user; + if ( $user->isLoggedIn() ){ + redirect("index"); + } ?>