Exemple #1
0
 /**
  * Requires an authorized session and a valid `nonce` GET parameter.
  *
  * If the client did not send a valid nonce along with the request, this
  * function will redirect the client to another page.
  *
  * This function will call Page::requireLogin prior to any other actions.
  *
  * @param string $redirectTo
  */
 public static final function requireNonce($redirectTo = 'home')
 {
     self::requireLogin();
     $data = \tniessen\tinyIt\HttpParams::_GET();
     $okay = $data->has('nonce') && Authorization::isNonce($data->get('nonce'));
     if (!$okay) {
         self::redirectTo($redirectTo);
         exit;
     }
 }