function drupal_access_denied

7.x common.inc drupal_access_denied()
6.x common.inc drupal_access_denied()

Generates a 403 error if the request is not allowed.

Related topics

10 calls to drupal_access_denied()
aggregator_admin_refresh_feed in drupal-6.x/modules/aggregator/aggregator.admin.inc
Menu callback; refreshes a feed, then redirects to the overview page.
book_export_html in drupal-6.x/modules/book/book.pages.inc
This function is called by book_export() to generate HTML for export.
comment_edit in drupal-6.x/modules/comment/comment.pages.inc
Form builder; generate a comment editing form.
file_download in drupal-6.x/includes/file.inc
Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
index.php in drupal-6.x/index.php
The PHP page that serves all page requests on a Drupal installation.

... See full list

File

drupal-6.x/includes/common.inc, line 405
Common functions that many Drupal modules will need to reference.

Code

function drupal_access_denied() {
  drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');

  watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);

  // Keep old path for reference, and to allow forms to redirect to it.
  if (!isset($_REQUEST['destination'])) {
    $_REQUEST['destination'] = $_GET['q'];
  }

  $path = drupal_get_normal_path(variable_get('site_403', ''));
  if ($path && $path != $_GET['q']) {
    // Set the active item in case there are tabs to display or other
    // dependencies on the path.
    menu_set_active_item($path);
    $return = menu_execute_active_handler($path);
  }

  if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
    drupal_set_title(t('Access denied'));
    $return = t('You are not authorized to access this page.');
  }
  print theme('page', $return);
}