3 /** @package verysimple::Authentication */
6 * Auth404 provided 401 authentication
8 * @package verysimple::Authentication
9 * @author VerySimple Inc.
10 * @copyright 1997-2007 VerySimple, Inc.
11 * @license http://www.gnu.org/licenses/lgpl.html LGPL
18 * Send 401 headers to the browser
21 * string message to output as "Basic realm" text/message (default "Login Required")
23 * bool true to terminate php after outputting headers (default true)
25 static function OutputHeaders($realm = "Login Required", $terminate = true)
27 header("WWW-Authenticate: Basic realm=\"" . $realm . "\"");
28 header("Status: 401 Unauthorized");
29 header("HTTP-Status: 401 Unauthorized");
36 * Returns the server AUTH_USERNAME if provided or returns empty string
40 static function GetUsername()
42 return isset($_SERVER ["PHP_AUTH_USER"]) ?
$_SERVER ["PHP_AUTH_USER"] : "";
46 * Returns the server AUTH_PASSWORD if provided or returns empty string
50 static function GetPassword()
52 return isset($_SERVER ["PHP_AUTH_PW"]) ?
$_SERVER ["PHP_AUTH_PW"] : "";