本文整理汇总了PHP中drupal_hmac_base64函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_hmac_base64函数的具体用法?PHP drupal_hmac_base64怎么用?PHP drupal_hmac_base64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_hmac_base64函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drupalGetToken
/**
* Generate a token for the currently logged in user.
*/
protected function drupalGetToken($value = '')
{
$private_key = drupal_get_private_key();
return drupal_hmac_base64($value, $this->session_id . $private_key);
}
示例2: hook_authcache_cookie_alter
/**
* Modify information about cookies set by other modules.
*
* In this example the simple nocache-cookie is replaced with a a HMAC bound to
* the session. Note that for this example to be effective it is necessary to
* implement a corresponding validation function suitable for the caching
* backend in place. Point the variable authcache_builtin_nocache_get to the
* name of an appropriate implementation when the default builtin cache backend
* is used.
*
* $conf['authcache_builtin_nocache_get'] = 'my_nocache_get';
*
* @see hook_authcache_cookie()
* @see authcache_fix_cookies()
* @see _authcacheinc_default_nocache_get()
*/
function hook_authcache_cookie_alter(&$cookies, $account)
{
global $user;
if (!empty($cookies['nocache']['present'])) {
if ($user->uid) {
$hmac = drupal_hmac_base64('nocache', session_id() . variable_get('my_nocache_auth_key'));
} else {
$hmac = drupal_hmac_base64('nocache', ip_address() . variable_get('my_nocache_auth_key'));
}
$cookies['nocache']['value'] = $hmac;
}
}