コード例 #1
0
ファイル: Key.php プロジェクト: splitice/radical-web-event
 function __construct($callback = null, $ttl = -1)
 {
     //Maximum entropy, minimum data
     $this->id = \Radical\Basic\String\Random::GenerateBase64(6) . dechex(crc32(session_id() . time()));
     $len = strlen($this->id) - rand(0, 4);
     $this->id = substr($this->id, 0, $len);
     $this->key = \Radical\Basic\String\Random::GenerateBytes(32);
     $this->callback = $callback;
     if ($ttl > 0) {
         $this->expires = $ttl + time();
     }
     KeyStorage::AddKey($this);
 }