fixing HTTP AUTH (was in test, now in production)
This commit is contained in:
parent
df31733d28
commit
06f77b057f
|
@ -59,18 +59,18 @@ if (ini_get("safe_mode")) {
|
|||
|
||||
// For people who want to authenticate with HTTP AUTH
|
||||
if (isset($_GET['http_auth'])) $http_auth=strval($_GET['http_auth']);
|
||||
if (isset($http_auth) && $http_auth) {
|
||||
if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) {
|
||||
header('WWW-Authenticate: Basic realm="Test Authentication System"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
exit();
|
||||
}
|
||||
if (isset($http_auth)) {
|
||||
if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) {
|
||||
header('WWW-Authenticate: Basic realm="AlternC Authentication"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
|
||||
// Gruiiik
|
||||
$_REQUEST["username"]=$_SERVER['PHP_AUTH_USER'];
|
||||
$_REQUEST["password"]=$_SERVER['PHP_AUTH_PW'];
|
||||
}
|
||||
}
|
||||
|
||||
// proper srand (not using time(), which is what PHP does!)
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
|
@ -179,6 +179,11 @@ $hooks=new m_hooks();
|
|||
/* Check the User identity (if required) */
|
||||
if (!defined('NOCHECK')) {
|
||||
if (!$mem->checkid()) {
|
||||
if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
|
||||
header('WWW-Authenticate: Basic realm="AlternC Authentication"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
exit();
|
||||
}
|
||||
$error=$err->errstr();
|
||||
include("$root/admin/index.php");
|
||||
exit();
|
||||
|
|
Loading…
Reference in New Issue