Function __global->access_denied

Definitions

sources/permissions.php

  • Show a helpful access-denied page. Has a login ability if it senses that logging in could curtail the error.Note that this function should only be used for cases where access is being denied based on credentials, not for when access is blocked for other reasons (such as to enforce flow security). Using warn_exit with INTERNAL_ERROR is for those situations, or log_hack_attack_and_exit + warn_exit.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$class ID_TEXT No No ACCESS_DENIED N/A N/A The class of error (e.g. PRIVILEGE). This is a language string codename.
$param string No No Blank (empty string) N/A N/A The parameter given to the error message
$force_login boolean No No False N/A N/A Force the user to login (even if perhaps they are logged in already)

Preview

Code (PHP)

/**
 * Show a helpful access-denied page. Has a login ability if it senses that logging in could curtail the error.Note that this function should only be used for cases where access is being denied based on credentials, not for when access is blocked for other reasons (such as to enforce flow security). Using warn_exit with INTERNAL_ERROR is for those situations, or log_hack_attack_and_exit + warn_exit.
 *
 * @param  ID_TEXT $class The class of error (e.g. PRIVILEGE). This is a language string codename.
 * @param  string $param The parameter given to the error message
 * @param  boolean $force_login Force the user to login (even if perhaps they are logged in already)
 */

function access_denied(string $class = 'ACCESS_DENIED', string $param = '', bool $force_login = false)