You are here

function drupal_valid_token in Drupal 6

Same name and namespace in other branches
  1. 4 includes/common.inc \drupal_valid_token()
  2. 5 includes/common.inc \drupal_valid_token()
  3. 7 includes/common.inc \drupal_valid_token()

Validate a token based on $value, the current user session and private key.

Parameters

$token: The token to be validated.

$value: An additional value to base the token on.

$skip_anonymous: Set to true to skip token validation for anonymous users.

Return value

True for a valid token, false for an invalid token. When $skip_anonymous is true, the return value will always be true for anonymous users.

6 calls to drupal_valid_token()
aggregator_admin_refresh_feed in modules/aggregator/aggregator.admin.inc
Menu callback; refreshes a feed, then redirects to the overview page.
drupal_validate_form in includes/form.inc
Validates user-submitted form data from the $form_state using the validate functions defined in a structured form array.
form_builder in includes/form.inc
Walk through the structured form array, adding any required properties to each element and mapping the incoming $_POST data to the proper elements.
form_get_cache in includes/form.inc
Fetch a form from cache.
system_date_time_lookup in modules/system/system.admin.inc
Return the date for a given format string via Ajax.

... See full list

File

includes/common.inc, line 2693
Common functions that many Drupal modules will need to reference.

Code

function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
  global $user;
  return $skip_anonymous && $user->uid == 0 || $token === md5(session_id() . $value . variable_get('drupal_private_key', ''));
}