Revision 13616
Added by Aaron Marcuse-Kubitza over 10 years ago
index.php | ||
---|---|---|
13 | 13 |
}; |
14 | 14 |
} |
15 | 15 |
|
16 |
function user2path($user) # multiple @ and nested . OK: a@b.c@host -> host?b.c.a |
|
17 |
{ return implode(".", array_reverse(explode("@", $user))); } |
|
18 |
|
|
19 |
# redirect subpath@host? -> host?subpath (one type of prefix redirect) |
|
20 |
# better than subpath.host because case is preserved and special chars allowed |
|
21 |
# must require trailing ? , to avoid needing login to view the page itself |
|
22 |
# subpath prefix: see format in user2path() |
|
23 |
if (substr($_SERVER["REQUEST_URI"], -1/*last char*/) === "?") |
|
24 |
{ |
|
25 |
if (!isset($_SERVER["PHP_AUTH_USER"])) # browser first omits Authorization |
|
26 |
{ |
|
27 |
header('WWW-Authenticate: Basic realm="please leave username/password blank or as filled in"'); |
|
28 |
} |
|
29 |
elseif ($_SERVER["PHP_AUTH_USER"] !== "") |
|
30 |
{ |
|
31 |
header("Location: ?".user2path($_SERVER["PHP_AUTH_USER"])); |
|
32 |
exit; |
|
33 |
} |
|
34 |
# otherwise, user empty so just display page |
|
35 |
} |
|
36 |
|
|
37 | 16 |
$h_level = 5; |
38 | 17 |
$root = $_SERVER["SERVER_NAME"].rm_suffix("/", $self_dir)."?"; |
39 | 18 |
# instead of PATH_INFO, to support the Apache ErrorDocument directive |
Also available in: Unified diff
web/index.php: removed no longer needed redirection of username-based prefix subpaths, which is now handled by web/.htaccess