Example #1
0
 /**
  * @param $criteria
  * @param int $lifetime (seconds)
  *
  * @return bool
  */
 public function Login($criteria, $lifetime)
 {
     $sid = (bool) $this->_sid;
     $storage = self::_storage($this->_name, $this->_sid);
     $this->_sid = Quark::GuID();
     $this->_signature = Quark::GuID();
     $this->_ttl = $lifetime;
     $old = $storage->Location();
     $storage->Location($storage->parent . '/' . $this->_name . '-' . $this->_sid . '.sid');
     $new = $storage->Location();
     if ($sid) {
         rename($old, $new);
     }
     $storage->Content(json_encode(array('user' => $this->_user->Extract(), 'signature' => $this->_signature, 'ttl' => $this->_ttl)));
     $storage->SaveContent();
     return $this->_end($lifetime);
 }