2 /** @package verysimple::Authentication */
5 * Auth404 provided 401 authentication
7 * @package verysimple::Authentication
8 * @author VerySimple Inc.
9 * @copyright 1997-2007 VerySimple, Inc.
10 * @license http://www.gnu.org/licenses/lgpl.html LGPL
17 * Send 401 headers to the browser
20 * string message to output as "Basic realm" text/message (default "Login Required")
22 * bool true to terminate php after outputting headers (default true)
24 static function OutputHeaders($realm = "Login Required", $terminate = true) {
25 header ( "WWW-Authenticate: Basic realm=\"" . $realm . "\"" );
26 header ( "Status: 401 Unauthorized" );
27 header ( "HTTP-Status: 401 Unauthorized" );
33 * Returns the server AUTH_USERNAME if provided or returns empty string
37 static function GetUsername() {
38 return isset ( $_SERVER ["PHP_AUTH_USER"] ) ?
$_SERVER ["PHP_AUTH_USER"] : "";
42 * Returns the server AUTH_PASSWORD if provided or returns empty string
46 static function GetPassword() {
47 return isset ( $_SERVER ["PHP_AUTH_PW"] ) ?
$_SERVER ["PHP_AUTH_PW"] : "";