Horde_Token::generateId PHP Method

generateId() public static method

Generates a connection id and returns it.
public static generateId ( string $seed = '' ) : string
$seed string A unique ID to be included in the token.
return string The generated id string.
    public static function generateId($seed = '')
    {
        return Horde_Url::uriB64Encode(pack('H*', hash('sha1', uniqid(mt_rand()) . $seed . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''))));
    }

Usage Example

Example #1
0
 /**
  * Get a token for protecting a form.
  *
  * @since Horde 3.2
  */
 function getRequestToken($slug)
 {
     require_once 'Horde/Token.php';
     $token = Horde_Token::generateId($slug);
     $_SESSION['horde_form_secrets'][$token] = true;
     return $token;
 }
All Usage Examples Of Horde_Token::generateId
Horde_Token