diff --git a/login.php b/login.php index 1aa606d50..92646c16a 100644 --- a/login.php +++ b/login.php @@ -13,10 +13,20 @@ if ($login && $password) { if (authenticate_user($link, $login, $password)) { initialize_user_prefs($link, $_SESSION["uid"]); - header("Location: tt-rss.php"); + + if ($_SESSION["login_redirect"]) { + $redirect_to = $_SESSION["login_redirect"]; + } else { + $redirect_to = "tt-rss.php"; + } + header("Location: $redirect_to"); } } + if ($_GET["rt"]) { + $_SESSION["login_redirect"] = $_GET["rt"]; + } + ?> diff --git a/prefs.php b/prefs.php index 4c19f687f..0673fd36f 100644 --- a/prefs.php +++ b/prefs.php @@ -12,7 +12,7 @@ if (!USE_HTTP_AUTH) { if (!$_SESSION["uid"]) { - header("Location: login.php"); + header("Location: login.php?rt=prefs.php"); exit; } } else { diff --git a/tt-rss.php b/tt-rss.php index 4e66d2f9e..0f4a72dc1 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -12,7 +12,7 @@ if (!USE_HTTP_AUTH) { if (!$_SESSION["uid"]) { - header("Location: login.php"); + header("Location: login.php?rt=tt-rss.php"); exit; } } else {