예제 #1
0
파일: blog.php 프로젝트: netstao/swoole.com
 function detail()
 {
     $id = (int) $_GET['id'];
     $_blog = createModel('UserLogs');
     $blog = $_blog->get($id);
     if (empty($_COOKIE['look']) and $_COOKIE['look'] != $id) {
         $blog->look_count++;
         $blog->save();
         Swoole\Cookie::set('look', $id, time() + 3600);
     }
     $uid = $blog['uid'];
     $this->userinfo($uid);
     $_c = createModel('UserComment');
     $comments = $_c->getByAid('blog', $id);
     $this->swoole->tpl->assign('comments', $comments);
     $this->swoole->tpl->assign('blog', $blog->get());
     return $this->swoole->tpl->fetch('blog_detail.html');
 }
예제 #2
0
 private function ifDeny()
 {
     $owners = explode(',', $this->project['owner']);
     if (!in_array($_SESSION['user_id'], $owners)) {
         return true;
     } else {
         if (!isset($_COOKIE['wiki_admin'])) {
             Swoole\Cookie::set('wiki_admin', '1', 86400 * 30);
         }
         return false;
     }
 }
예제 #3
0
 /**
  * 注销登录
  * @return unknown_type
  */
 static function logout()
 {
     /**
      * 如果设置为true,退出登录时,销毁所有Session
      */
     if (self::$session_destroy) {
         session_destroy();
         return true;
     }
     unset($_SESSION[self::$session_prefix . 'isLogin']);
     unset($_SESSION[self::$session_prefix . 'user_id']);
     if (!empty($_SESSION[self::$session_prefix . 'save_key'])) {
         foreach ($_SESSION[self::$session_prefix . 'save_key'] as $sk) {
             unset($_SESSION[$sk]);
         }
     }
     unset($_SESSION[self::$session_prefix . 'save_key']);
     if (isset($_COOKIE[self::$session_prefix . 'password'])) {
         Swoole\Cookie::set(self::$session_prefix . 'password', '', 0, '/');
     }
 }
예제 #4
0
파일: page.php 프로젝트: netstao/swoole.com
 private function setLoginStat()
 {
     $tm = time();
     Swoole\Cookie::set('uname', $_SESSION['user']['nickname'], $tm + 86400 * 30, '/');
     Swoole\Cookie::set('uid', $_SESSION['user_id'], $tm + 86400 * 30, '/');
 }