From f6d0ab1498706b7e3a1aa55b87f5b4cb8707b267 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 19 Nov 2005 12:31:35 +0100 Subject: [PATCH] redirect back support for login.php --- login.php | 12 +++++++++++- prefs.php | 2 +- tt-rss.php | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) 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 {