function basic($func=NULL) {
		$fw=Base::instance();
		$realm=$fw->REALM;
		$hdr=NULL;
		if (isset($_SERVER['HTTP_AUTHORIZATION']))
			$hdr=$_SERVER['HTTP_AUTHORIZATION'];
		elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
			$hdr=$_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
		if (!empty($hdr))
			list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])=
				explode(':',base64_decode(substr($hdr,6)));
		if (isset($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) &&
			$this->login(
				$_SERVER['PHP_AUTH_USER'],
				$func?
					$fw->call($func,$_SERVER['PHP_AUTH_PW']):
					$_SERVER['PHP_AUTH_PW'],
				$realm
			))
			return TRUE;
		if (PHP_SAPI!='cli')
			header('WWW-Authenticate: Basic realm="'.$realm.'"');
		$fw->status(401);
		return FALSE;
	}
function basic($func=NULL) {
		$fw=Base::instance();
		$realm=$fw->REALM;
		$hdr=NULL;
		if (isset($_SERVER['HTTP_AUTHORIZATION']))
			$hdr=$_SERVER['HTTP_AUTHORIZATION'];
		elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
			$hdr=$_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
		if (!empty($hdr))
			list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])=
				explode(':',base64_decode(substr($hdr,6)));
		if (isset($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) &&
			$this->login(
				$_SERVER['PHP_AUTH_USER'],
				$func?
					$fw->call($func,$_SERVER['PHP_AUTH_PW']):
					$_SERVER['PHP_AUTH_PW'],
				$realm
			))
			return TRUE;
		if (PHP_SAPI!='cli')
			header('WWW-Authenticate: Basic realm="'.$realm.'"');
		$fw->status(401);
		return FALSE;
	}
function basic ( $ func = NULL ) { $ fw = Base :: instance ( ) ; $ realm = $ fw -> REALM ; $ hdr = NULL ; if ( isset ( $ _SERVER [ 'HTTP_AUTHORIZATION' ] ) ) $ hdr = $ _SERVER [ 'HTTP_AUTHORIZATION' ] ; elseif ( isset ( $ _SERVER [ 'REDIRECT_HTTP_AUTHORIZATION' ] ) ) $ hdr = $ _SERVER [ 'REDIRECT_HTTP_AUTHORIZATION' ] ; if ( ! empty ( $ hdr ) ) list ( $ _SERVER [ 'PHP_AUTH_USER' ] , $ _SERVER [ 'PHP_AUTH_PW' ] ) = explode ( ':' , base64_decode ( substr ( $ hdr , 6 ) ) ) ; if ( isset ( $ _SERVER [ 'PHP_AUTH_USER' ] , $ _SERVER [ 'PHP_AUTH_PW' ] ) && $ this -> login ( $ _SERVER [ 'PHP_AUTH_USER' ] , $ func ? $ fw -> call ( $ func , $ _SERVER [ 'PHP_AUTH_PW' ] ) : $ _SERVER [ 'PHP_AUTH_PW' ] , $ realm ) ) return TRUE ; if ( PHP_SAPI != 'cli' ) header ( 'WWW-Authenticate: Basic realm="' . $ realm . '"' ) ; $ fw -> status ( 401 ) ; return FALSE ; }
HTTP basic auth mechanism
@return bool
@param $func callback
HTTP basic auth mechanism