1
0
Fork 0
gnuviechadmin-historic/php/wantauth.php
Jan Dittberner 4c553504b2 basic setup and login mechanisms are done
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@23 a67ec6bc-e5d5-0310-a910-815c51eb3124
2003-11-23 20:44:06 +00:00

20 lines
No EOL
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();
}
?>