public function set($name, $ttl = 3600) {
    $rand = $this->psl['crypt/rand'];
    $cache = $this->psl['cache'];

    $token = $rand->str(32, $this->_charset);
    /* Save the token to the cahce. */
    $cache->cacheSet('token-'.$name, $token, $ttl);
    return $token;
  }
public function set($name, $ttl = 3600) {
    $rand = $this->psl['crypt/rand'];
    $cache = $this->psl['cache'];

    $token = $rand->str(32, $this->_charset);
    /* Save the token to the cahce. */
    $cache->cacheSet('token-'.$name, $token, $ttl);
    return $token;
  }
public function set ( $ name , $ ttl = 3600 ) { $ rand = $ this -> psl [ 'crypt/rand' ] ; $ cache = $ this -> psl [ 'cache' ] ; $ token = $ rand -> str ( 32 , $ this -> _charset ) ; /* Save the token to the cahce. */ $ cache -> cacheSet ( 'token-' . $ name , $ token , $ ttl ) ; return $ token ; }
Generate and save a one-time-token for a form. Used to protect against
CSRF attacks.

@param string $name
Name of the form to generate a token for.

@param integer $ttl
How long the token should be valid in seconds.

@return string
The token to supply with the form data.
Generate and save a one - time - token for a form . Used to protect against CSRF attacks .