original_string: public function requireBasicAuth($check_auth = '', $realm = 'Please enter your username and password')
      {
  
          $authorized = false;
          if (!isset($_SERVER['PHP_AUTH_USER'])) {
              header('WWW-Authenticate: Basic realm="' . $realm . '"');
              header('HTTP/1.0 401 Unauthorized');
              echo 'You must authenticate to continue';
          } else {
  
              if (is_callable($check_auth)) {
                  $authorized = $check_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
              }
  
              if (!$authorized) {
                  session_unset();
                  unset($_SERVER['PHP_AUTH_USER']);
                  return $this->requireBasicAuth($check_auth, $realm);
              }
          }
  
          return $authorized;
      }
code: public function requireBasicAuth($check_auth = '', $realm = 'Please enter your username and password')
      {
  
          $authorized = false;
          if (!isset($_SERVER['PHP_AUTH_USER'])) {
              header('WWW-Authenticate: Basic realm="' . $realm . '"');
              header('HTTP/1.0 401 Unauthorized');
              echo 'You must authenticate to continue';
          } else {
  
              if (is_callable($check_auth)) {
                  $authorized = $check_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
              }
  
              if (!$authorized) {
                  session_unset();
                  unset($_SERVER['PHP_AUTH_USER']);
                  return $this->requireBasicAuth($check_auth, $realm);
              }
          }
  
          return $authorized;
      }
code_tokens: public function requireBasicAuth ( $ check_auth = '' , $ realm = 'Please enter your username and password' ) { $ authorized = false ; if ( ! isset ( $ _SERVER [ 'PHP_AUTH_USER' ] ) ) { header ( 'WWW-Authenticate: Basic realm="' . $ realm . '"' ) ; header ( 'HTTP/1.0 401 Unauthorized' ) ; echo 'You must authenticate to continue' ; } else { if ( is_callable ( $ check_auth ) ) { $ authorized = $ check_auth ( $ _SERVER [ 'PHP_AUTH_USER' ] , $ _SERVER [ 'PHP_AUTH_PW' ] ) ; } if ( ! $ authorized ) { session_unset ( ) ; unset ( $ _SERVER [ 'PHP_AUTH_USER' ] ) ; return $ this -> requireBasicAuth ( $ check_auth , $ realm ) ; } } return $ authorized ; }
docstring: Added option for requesting basic auth.  ONLY USE OVER SSL
  @param callable $check_auth  the callable that determines success or not
  @param string $realm the realm beings used
  @return boolean
docstring_tokens: Added option for requesting basic auth . ONLY USE OVER SSL