]> git.wh0rd.org - tt-rss.git/commitdiff
redirect back support for login.php
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 11:31:35 +0000 (12:31 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 11:31:35 +0000 (12:31 +0100)
login.php
prefs.php
tt-rss.php

index 1aa606d5083fe2a2a9fe33b3de77498e2dc2caf7..92646c16a1d4146bc8dfb44e98188686a5106783 100644 (file)
--- a/login.php
+++ b/login.php
        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"];
+       }
+
 ?>
 <html>
 <head>
index 4c19f687f73d7af201cb41f6bb5eaef0997a544d..0673fd36fa3280c0316968875f3d8d6597edcdc6 100644 (file)
--- 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 {
index 4e66d2f9e411e6a53d4222cc7e32f3ddebd82a8e..0f4a72dc1f49c89160f22c53b9ae1251d5f17968 100644 (file)
@@ -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 {