function drupal_valid_token
drupal_valid_token($token, $value = '', $skip_anonymous = FALSE)
Validates a token based on $value, the user session, and the 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.
File
- includes/common.inc, line 5220
- 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 === drupal_get_token($value))); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_valid_token/7.x