You are here

function drupal_get_private_key in Drupal 4

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

Ensure the private key variable used to generate tokens is set.

Return value

The private key

Related topics

1 call to drupal_get_private_key()
drupal_get_token in includes/common.inc
Generate a token based on $value, the current user session and private key.

File

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

Code

function drupal_get_private_key() {
  if (!($key = variable_get('drupal_private_key', 0))) {
    $key = mt_rand();
    variable_set('drupal_private_key', $key);
  }
  return $key;
}