Revision 13694
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/web/username_prefix.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
function login__from_env() |
|
3 |
{ |
|
4 |
return $_SERVER["PHP_AUTH_USER"] |
|
5 |
.($_SERVER["PHP_AUTH_PW"] !== "" ? ":".$_SERVER["PHP_AUTH_PW"] : ""); |
|
6 |
} |
|
7 |
|
|
2 | 8 |
function user2path($user) # multiple @ and nested . OK: a@b.c@url -> url?b.c.a |
3 | 9 |
{ return implode(".", array_reverse(explode("@", $user))); } |
4 | 10 |
|
... | ... | |
11 | 17 |
$dest = preg_replace('!\b/!', "./", $_SERVER["SCRIPT_URI"])."?"; |
12 | 18 |
# append trailing . to host to prevent infinite redirect loop |
13 | 19 |
if ($_SERVER["PHP_AUTH_USER"] !== "") # prepend to query string |
14 |
$dest .= "."/*force dotpath*/.user2path($_SERVER["PHP_AUTH_USER"]);
|
|
20 |
$dest .= "."/*force dotpath*/.user2path(login__from_env());
|
|
15 | 21 |
$dest .= $_SERVER["QUERY_STRING"]; |
16 | 22 |
|
17 | 23 |
header("Location: ".$dest); |
Also available in: Unified diff
bugfix: web/username_prefix.php: need to handle : in login (which would normally indicate a password)