1
0
Fork 0
gnuviechadmin-historic/php/wantauth.php

20 lines
552 B
PHP

<?php
/**
* start a request for HTTP Authentication
*/
function authenticate() {
header('WWW-Authenticate: Basic realm="GNU-viech administration tool"');
header('HTTP/1.0 401 Unauthorized');
echo _("You are not allowed to use this application without valid authentication data.");
printf(_("You entered: %s, %s (md5: %s)"),
$_SERVER["PHP_AUTH_USER"],
$_SERVER["PHP_AUTH_PW"],
md5($_SERVER["PHP_AUTH_PW"]));
exit;
}
// common code to force that the user is authenticated
if (!isset($_SERVER['PHP_AUTH_USER'])) {
authenticate();
}
?>