12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php if (!defined('PmWiki')) exit();
- if (IsEnabled($EnableRemoteUserAuth, 1) && @$_SERVER['REMOTE_USER']) {
- SDV($EnableHTTPBasicAuth, 0);
- SDV($AuthId, $_SERVER['REMOTE_USER']);
- }
- if (@$_SERVER['PHP_AUTH_PW']) {
- @session_start();
- @$_SESSION['authpw'][$_SERVER['PHP_AUTH_PW']]++;
- $_REQUEST[session_name()] = 1;
- }
- if (IsEnabled($EnableHTTPBasicAuth, 1))
- SDV($AuthPromptFmt, 'function:HTTPBasicAuthPrompt');
- function HTTPBasicAuthPrompt($pagename) {
- global $AuthRealmFmt, $AuthDeniedFmt;
- SDV($AuthRealmFmt,$GLOBALS['WikiTitle']);
- SDV($AuthDeniedFmt,'A valid password is required to access this feature.');
- $realm=FmtPageName($AuthRealmFmt,$pagename);
- header("WWW-Authenticate: Basic realm=\"$realm\"");
- header("Status: 401 Unauthorized");
- header("HTTP-Status: 401 Unauthorized");
- PrintFmt($pagename,$AuthDeniedFmt);
- exit;
- }
|