moving HTTP_AUTH from login.php to config.php, and use HTTP_AUTH if provided, even without ?http_auth=1

This commit is contained in:
Benjamin Sonntag 2011-02-04 15:24:14 +00:00
parent f40cb1bebe
commit 8c9f58d70f
2 changed files with 16 additions and 12 deletions

View File

@ -28,18 +28,6 @@
----------------------------------------------------------------------
*/
// For people who want to authenticate with HTTP AUTH
if (isset($_GET['http_auth'])) $http_auth=strval($_GET['http_auth']);
if ($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');
} else {
// Gruiiik
$_REQUEST["username"]=$_SERVER['PHP_AUTH_USER'];
$_REQUEST["password"]=$_SERVER['PHP_AUTH_PW'];
}
}
require_once("../class/config.php");

View File

@ -62,6 +62,22 @@ if (ini_get("safe_mode")) {
exit();
}
// For people who want to authenticate with HTTP AUTH
if (isset($_GET['http_auth'])) $http_auth=strval($_GET['http_auth']);
if ($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 (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
// Gruiiik
$_REQUEST["username"]=$_SERVER['PHP_AUTH_USER'];
$_REQUEST["password"]=$_SERVER['PHP_AUTH_PW'];
}
$help_baseurl="http://www.aide-alternc.org/";
/* PHPLIB inclusions : */