Project

General

Profile

« Previous | Next » 

Revision 13612

web/index.php: support prefix redirect of the form subpath@host? , which is better than subpath.host because case is preserved and special chars allowed. (must require trailing ? for redirect, to avoid needing login to view the page itself.)

View differences:

trunk/web/index.php
13 13
	};
14 14
}
15 15

  
16
# redirect subpath@host? -> host?subpath (one type of prefix redirect)
17
# better than subpath.host because case is preserved and special chars allowed
18
# must require trailing ? , to avoid needing login to view the page itself
19
if (substr($_SERVER["REQUEST_URI"], -1/*last char*/) === "?")
20
{
21
	if (!isset($_SERVER["PHP_AUTH_USER"])) # browser first omits Authorization
22
	{
23
		header('WWW-Authenticate: Basic realm="please leave username/password blank or as filled in"');
24
	}
25
	elseif ($_SERVER["PHP_AUTH_USER"] !== "")
26
	{
27
		header("Location: ?".$_SERVER["PHP_AUTH_USER"]);
28
		exit;
29
	}
30
	# otherwise, user empty so just display page
31
}
32

  
16 33
$h_level = 5;
17 34
$root = $_SERVER["SERVER_NAME"].rm_suffix("/", $self_dir)."?";
18 35
# instead of PATH_INFO, to support the Apache ErrorDocument directive

Also available in: Unified diff