diff --git a/check_login.php b/check_login.php index a0fd1573..acc89d32 100644 --- a/check_login.php +++ b/check_login.php @@ -18,7 +18,10 @@ if (!isset($config_enable_setup) || $config_enable_setup == 1) { // Check user is logged in with a valid session if (!isset($_SESSION['logged']) || !$_SESSION['logged']) { - header("Location: login.php"); + if($_SERVER["REQUEST_URI"] == "/") + header("Location: login.php"); + else + header("Location: login.php?url=".urlencode($_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) ); exit; } diff --git a/login.php b/login.php index 60538546..f3f1532a 100644 --- a/login.php +++ b/login.php @@ -218,8 +218,10 @@ if (isset($_POST['login'])) { //} } - - header("Location: $config_start_page"); + if($_GET['url']) + header("Location: ".$_GET['url']); + else + header("Location: $config_start_page"); } else {