public static function get_basic_auth() {
	// normally it just works
	if (!empty($_SERVER['PHP_AUTH_USER'])) {
		return [
			'USER' => $_SERVER['PHP_AUTH_USER'],
			'PW'   => $_SERVER['PHP_AUTH_PW'],
		];
	}
	
	// php cgi mode requires a work around
	if (!empty($_SERVER['REDIRECT_REMOTE_USER']) && strpos($_SERVER['REDIRECT_REMOTE_USER'], 'Basic ') === 0) {
		$credentials = substr($_SERVER['REDIRECT_REMOTE_USER'], strlen('Basic '));
		$credentials = base64_decode($credentials);
		if (strpos($credentials, ':')) {
			$credentials = explode(':', $credentials);
			return [
				'USER' => $credentials[0],
				'PW'   => $credentials[1],
			];
		}
	}
	
	return null;
}