Same name and namespace in other branches
- 4.7.x includes/common.inc \drupal_valid_token()
- 5.x includes/common.inc \drupal_valid_token()
- 6.x includes/common.inc \drupal_valid_token()
- 7.x includes/common.inc \drupal_valid_token()
Validate a token based on $value, the current user session and private key or penultimate private key.
Parameters
$token: The token to be validated.
$value: An additional value to base the token on
Return value
True for a valid token, False for an invalid token.
Related topics
File
- includes/
common.inc, line 962 - Common functions that many Drupal modules will need to reference.
Code
function drupal_valid_token($token, $value = '') {
return $token == md5(session_id() . $value . variable_get('drupal_private_key', ''));
}