Esempio n. 1
0
 /**
  * 用户登录服务
  * 
  * @param UserForm $userInfo
  * @return boolean
  */
 public function login($userInfo)
 {
     $db = $this->_getConnecion();
     $stmt = $db->createStatement('SELECT * FROM user WHERE username=:username AND password =:password');
     if (!$stmt->getValue(array('username' => $userInfo->getUsername(), 'password' => $userInfo->getPassword()))) {
         return false;
     }
     return WindCookie::set($this->cookieName, $userInfo);
 }
Esempio n. 2
0
 /**
  * 设置cookie
  *
  * @param string $name cookie名称
  * @param string $value cookie值,默认为null
  * @param string|int $expires 过期时间,默认为null即会话cookie,随着会话结束将会销毁
  * @param string $pre cookie前缀,默认为null即没有前缀
  * @param boolean $httponly
  * @return boolean
  */
 public static function setCookie($name, $value = null, $expires = null, $httponly = false)
 {
     $domain = Wekit::C('site', 'cookie.domain');
     $path = Wekit::C('site', 'cookie.path');
     $pre = Wekit::C('site', 'cookie.pre');
     $pre && ($name = $pre . '_' . $name);
     $expires && ($expires += self::getTime());
     return WindCookie::set($name, $value, false, $expires, $path, $domain, false, $httponly);
 }
 /**
  * 判断cookie值是否存在
  *
  * @param string $name
  */
 public function exist($name)
 {
     $this->prefix && ($name = $this->prefix . $name);
     return WindCookie::exist($name);
 }
Esempio n. 4
0
 public function getToken($tokenName)
 {
     return WindCookie::get($tokenName);
 }