summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-12-09 21:34:29 +0100
committerAndrew Dolgov <[email protected]>2005-12-09 21:34:29 +0100
commit75836f33860f26ca55ec8e8661cff4b0edc2fe5e (patch)
tree55856842d3fef1121e4765a78cab7f47f24b56b8 /functions.php
parenta24f525cce32a6515532ac9392a5b02838ff82be (diff)
option to redirect to https url for login, option ENABLE_LOGIN_SSL (fixes some non-absolute redirects)
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/functions.php b/functions.php
index ba80bab94..8b990740e 100644
--- a/functions.php
+++ b/functions.php
@@ -723,12 +723,34 @@
session_destroy();
}
+ function get_script_urlpath() {
+ $request_uri = $_SERVER["REQUEST_URI"];
+ return preg_replace('/\/[^\/]+$/', "", $request_uri);
+ }
+
+ function get_login_redirect() {
+ $server = $_SERVER["SERVER_NAME"];
+
+ if (ENABLE_LOGIN_SSL) {
+ $protocol = "https";
+ } else {
+ $protocol = "http";
+ }
+
+ $url_path = get_script_urlpath();
+
+ $redirect_uri = "$protocol://$server$url_path/login.php";
+
+ return $redirect_uri;
+ }
+
function login_sequence($link) {
if (!SINGLE_USER_MODE) {
-
+
if (!USE_HTTP_AUTH) {
if (!$_SESSION["uid"]) {
- header("Location: login.php?rt=tt-rss.php");
+ $redirect_uri = get_login_redirect();
+ header("Location: $redirect_uri?rt=tt-rss.php");
exit;
}
} else {