Beispiel #1
0
 public function testGenGUID()
 {
     $this->assertEquals(32, strlen(gen_guid()));
 }
Beispiel #2
0
 public static function tokenCreate($id, $remote_ip, $user_agent)
 {
     //try to reuse an existing token
     $token = self::findToken($id, $remote_ip, $user_agent);
     if ($token) {
         return $token['token'];
     }
     //create a new token
     $token = gen_guid();
     $expires = time() + Config::get(static::$config_name, 'token_life');
     Db::_get()->insert(static::$session_table, array('token' => $token, self::$user_primary_key => $id, 'remote_ip' => $remote_ip, 'user_agent' => $user_agent, 'expires' => $expires, 'is_active' => 1));
     return $token;
 }