当前位置: 首页>>代码示例>>PHP>>正文


PHP Pw::getCookie方法代码示例

本文整理汇总了PHP中Pw::getCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::getCookie方法的具体用法?PHP Pw::getCookie怎么用?PHP Pw::getCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pw的用法示例。


在下文中一共展示了Pw::getCookie方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeAction

 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     $action = $handlerAdapter->getAction();
     if (in_array($action, array('fastreply', 'replylist'))) {
         return;
     }
     $this->post = $this->_getPost($action);
     if (($result = $this->post->check()) !== true) {
         $error = $result->getError();
         if (is_array($error) && $error[0] == 'BBS:post.forum.allow.ttype' && ($allow = $this->post->forum->getThreadType($this->post->user))) {
             $special = key($allow);
             $this->forwardAction('bbs/post/run?fid=' . $this->post->forum->fid . ($special ? '&special=' . $special : ''));
         }
         $this->showError($error);
     }
     //版块风格
     $pwforum = $this->post->forum;
     if ($pwforum->foruminfo['password']) {
         if (!$this->loginUser->isExists()) {
             $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/post/' . $action, array('fid' => ${$pwforum}->fid))));
         } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $pwforum->fid)) {
             $this->forwardAction('bbs/forum/password', array('fid' => $pwforum->fid));
         }
     }
     if ($pwforum->foruminfo['style']) {
         $this->setTheme('forum', $pwforum->foruminfo['style']);
     }
     $this->setOutput($action, 'action');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:30,代码来源:PostController.php

示例2: getResponseInfo

 /**
  * 获取回调响应
  */
 public function getResponseInfo()
 {
     $result = $this->checkStatus();
     if ($result !== true) {
         return new PwError($result);
     }
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     if (!$sessionId || !$sessionInfo) {
         return new PwError('验证会话失败,请重试');
     }
     if ($_REQUEST['state'] == $sessionInfo['sessiondata']['state']) {
         //step 2 通过Authorization Code获取Access Token
         $token = $this->_getAccessToken();
         if ($token === false) {
             return new PwError('验证会话失败,请重试');
         }
         list($accessToken, $uid) = $token;
         //step 2 获取用户信息
         $userInfo = $this->_getUserInfo($uid, $accessToken);
         if (!$userInfo) {
             return new PwError('获取用户信息失败,请重试');
         }
         //更新数据库
         $this->_updateDb($uid, $userInfo);
         //更新session
         $this->updateSession($uid, $userInfo['screen_name'], 'sinaweibo');
         return true;
     }
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:33,代码来源:App_Account_SinaweiboService.php

示例3: reset

 public function reset()
 {
     $this->uid = 0;
     $this->gid = 2;
     $this->username = '游客';
     $this->info = array('lastpost' => Pw::getCookie('guest_lastpost'));
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:7,代码来源:AdminUserBo.php

示例4: getResponseInfo

 /**
  * 获取淘宝响应信息 如果oauth2正常流程,可以走curl_init
  */
 public function getResponseInfo()
 {
     $result = $this->checkStatus();
     if ($result !== true) {
         return new PwError($result);
     }
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     if (!$sessionId || !$sessionInfo) {
         return new PwError('验证会话失败,请重试');
     }
     list($top_parameters, $top_sign) = array(trim($_REQUEST['top_parameters']), trim($_REQUEST['top_sign']));
     if ($this->_checkSign() === false) {
         return new PwError('与淘宝通信失败,请重试');
     }
     $userInfo = $this->_getUserInfo();
     if ($userInfo === false) {
         return new PwError('获取用户信息失败,请重试');
     }
     list($user_id, $nick) = $userInfo;
     //更新数据库
     $info = $this->_getTaobaoUserInfoDs()->get($user_id);
     if (!$info) {
         $dm = new App_Account_TaobaoUserInfoDm();
         $dm->setUserId($user_id)->setNick($nick)->setCreateAt(Pw::getTime());
         $this->_getTaobaoUserInfoDs()->add($dm);
     }
     //更新session
     $this->updateSession($user_id, $nick, 'taobao');
     return true;
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:34,代码来源:App_Account_TaobaoService.php

示例5: getResponseInfo

 public function getResponseInfo()
 {
     $result = $this->checkStatus();
     if ($result !== true) {
         return new PwError($result);
     }
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     if (!$sessionId || !$sessionInfo) {
         return new PwError('验证会话失败,请重试');
     }
     //计算得出通知验证结果
     if (!$this->_verifyReturn()) {
         return new PwError('验证会话失败,请重试');
     }
     //支付宝用户号
     $user_id = intval($_GET['user_id']);
     //授权令牌
     $token = trim($_GET['token']);
     $real_name = trim($_GET['real_name']);
     if (!$user_id) {
         return new PwError('获取用户信息失败,请重试');
     }
     //更新数据库
     $dm = new App_Account_AlipayUserInfoDm();
     $dm->setUserId($user_id)->setRealName($real_name)->setCreateAt(Pw::getTime());
     $this->_getAlipayUserInfoDs()->replace($dm);
     //更新session
     $this->updateSession($user_id, $real_name, 'alipay');
     return true;
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:31,代码来源:App_Account_AlipayService.php

示例6: _getLoginUser

 protected function _getLoginUser()
 {
     $userCookie = Pw::getCookie('AdminUser');
     /* @var $adminUserService AdminUserService */
     $adminUserService = Wekit::load('ADMIN:service.srv.AdminUserService');
     if ($userCookie) {
         list($type, $uid, $password) = explode("\t", Pw::decrypt($userCookie));
         /* @var $founderService AdminFounderService */
         $founderService = Wekit::load('ADMIN:service.srv.AdminFounderService');
         if ($founderService->isFounder($uid)) {
             $founders = $founderService->getFounders();
             list($md5pwd) = explode('|', $founders[$uid], 2);
             $userinfo = $adminUserService->verifyUserByUsername($uid);
             $userinfo['password'] = $md5pwd;
         } else {
             $userinfo = $adminUserService->loadUserService()->getUserByUid($uid);
         }
     } else {
         $password = '';
         $userinfo = array();
     }
     Wind::import('ADMIN:service.bo.AdminDefaultUserBo');
     $user = new AdminDefaultUserBo($userinfo);
     if (!$user->isExists() || Pw::getPwdCode($userinfo['password']) != $password) {
         $user->reset();
     }
     return $user;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:28,代码来源:adminBoot.php

示例7: getResponseInfo

 /**
  * 获取QQ回调响应
  */
 public function getResponseInfo()
 {
     $result = $this->checkStatus();
     if ($result !== true) {
         return new PwError($result);
     }
     $params = array_merge($_GET, $_POST);
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     if (!$sessionId || !$sessionInfo) {
         return new PwError('验证会话失败,请重试');
     }
     if ($params['state'] == $sessionInfo['sessiondata']['state']) {
         //step 2 通过Authorization Code获取Access Token
         $accessToken = $this->_getAccessToken();
         if ($accessToken === false) {
             return new PwError('验证会话失败,请重试');
         }
         /*
          * step3:使用Access Token来获取用户的OpenID
          * openid 用户唯一标识
          */
         $openId = $this->_getOpenIdByAccessToken($accessToken);
         if ($openId === false) {
             return new PwError('验证会话失败,请重试');
         }
         //step4: 使用openid获取用户信息
         $userInfo = $this->_getUserInfo($openId, $accessToken);
         if ($userInfo === false || !$userInfo) {
             return new PwError('获取用户信息失败,请重试');
         }
         //更新数据库
         $userId = $this->_updateDb($openId, $userInfo);
         if ($userId === false || $userId < 1) {
             return new PwError('更新数据库失败');
         }
         //更新session
         $this->updateSession($userId, $userInfo['nickname'], 'qzone');
         return true;
     }
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:44,代码来源:App_Account_QzoneService.php

示例8: _getLoginUser

 protected function _getLoginUser()
 {
     if (!($userCookie = Pw::getCookie('AdminUser'))) {
         $password = '';
         $us = new AdminUserSourceDb(0);
     } else {
         list($type, $uid, $password) = explode("\t", Pw::decrypt($userCookie));
         if ($type == AdminUserService::FOUNDER) {
             $us = new AdminUserSourceFounder($uid);
         } else {
             $us = new AdminUserSourceDb($uid);
         }
     }
     Pw::setCookie('AdminUser', $userCookie, 1800);
     $user = new AdminUserBo($us);
     if (!$user->isExists() || Pw::getPwdCode($user->info['password']) != $password) {
         $user->reset();
     } else {
         unset($user->info['password']);
     }
     return $user;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:22,代码来源:pwadminBoot.php

示例9: routeAction

 /**
  * 结果分析路由
  */
 public function routeAction()
 {
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     $sessionData = $sessionInfo['sessiondata'];
     $refer = $sessionData['httpReferer'] ? $sessionData['httpReferer'] : $this->hostInfo;
     if (!$this->_getAccountTypeService()->checkType($sessionData['type'])) {
         $this->showError('登录类型错误,请重试');
     }
     if (!$sessionId || !$sessionInfo || !$sessionData['data']['user_id'] || !$sessionData['action']) {
         $this->showError('验证失败,请重试');
     }
     $url = $refer ? $refer : $this->hostInfo . Wind::getComponent('request')->getScriptUrl();
     $type_name = $this->_getAccountTypeService()->getTypeName($sessionData['type']);
     $msg_info = '使用' . $type_name . '账号认证通过(窗口将自动关闭)';
     if ($sessionData['action'] == 'bind') {
         //绑定流程
         $result = $this->_getAccountBindService()->bind($this->uid, $sessionData['data']['user_id'], $sessionData['type']);
         if ($result instanceof PwError) {
             $this->showError($result->getError());
         }
     } elseif ($sessionData['data']['isBound'] == 0 && $sessionData['action'] == 'login') {
         $sign = $sessionData['data']['sign'];
         //没有绑定社区账号 注册或者绑定
         $config = Wekit::C()->getValues('register');
         if ($config['type'] == 0) {
             //关闭注册,跳转到绑定设置页面
             $url = WindUrlHelper::createUrl('app/login/run', array('app' => 'account', 'sign' => $sign));
         } else {
             $url = WindUrlHelper::createUrl('app/register/run', array('app' => 'account', 'sign' => $sign));
         }
     } elseif ($sessionData['data']['isBound'] == 1 && $sessionData['action'] == 'login') {
         //进入登录 用户校验
         $uid = intval($sessionData['data']['bbs_uid']);
         Wind::import('SRV:user.bo.PwUserBo');
         $userBo = PwUserBo::getInstance($uid);
         if (!$userBo->isExists()) {
             //用户不存在
             $this->_getAccountBindDs()->deleteByUid($uid);
             $this->showError('绑定用户在站点已删除,请重试');
         }
         $pattern = '/m=u&c=login/i';
         if (preg_match($pattern, $url)) {
             $url = $this->_getCommonService()->getHost();
         }
         $userService = Wekit::load('user.srv.PwUserService');
         $userService->createIdentity($userBo->uid, $userBo->info['password']);
     }
     $this->setOutput($msg_info, 'msg_info');
     $this->setOutput($url, 'jumpurl');
     $this->setOutput(Wekit::app()->charset, 'charset');
     $this->setTemplate('login_notice');
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:56,代码来源:IndexController.php

示例10: setTheme

 /**
  * 风格设置
  *
  * 设置当前页面风格,需要两个参数,$type风格类型,$theme该类型下风格
  *
  * @see WindSimpleController::setTheme()
  * @param string $type 风格类型(site,space,area...)
  * @param string $theme 风格别名
  */
 protected function setTheme($type, $theme)
 {
     $config = Wekit::C('site');
     $themePack = $config['theme.' . $type . '.pack'];
     $themePack = 'THEMES:' . $themePack;
     // 风格预览,管理员权限
     if ($style = Pw::getCookie('style_preview')) {
         list($s_theme, $s_type) = explode('|', $style, 2);
         if ($s_type == $type) {
             $theme = $s_theme;
             Wekit::C()->site->set('theme.' . $type . '.default', $theme);
         }
     }
     if (!$theme) {
         $theme = $config['theme.' . $type . '.default'];
     }
     parent::setTheme($theme, $themePack);
 }
开发者ID:BTSnowball,项目名称:BTSnowball_Users_Hand,代码行数:27,代码来源:PwBaseController.php

示例11: _getUser

 protected function _getUser()
 {
     $authkey = 'winduser';
     $pre = Wekit::C('site', 'cookie.pre');
     $pre && ($authkey = $pre . '_' . $authkey);
     $winduser = $this->getInput($authkey, 'post');
     if (!$winduser) {
         $winduser = Pw::getCookie('winduser');
         $winduser = urlencode($winduser);
     }
     list($uid, $password) = explode("\t", Pw::decrypt(urldecode($winduser)));
     $user = new PwUserBo($uid);
     if (!$user->isExists() || Pw::getPwdCode($user->info['password']) != $password) {
         return null;
     }
     unset($user->info['password']);
     return $user;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:18,代码来源:UploadController.php

示例12: _readVerifyCode

 private function _readVerifyCode()
 {
     return Pw::getCookie('Pw_verify_code');
     /*Wind::import('WIND:http.session.WindSession');
     		$session = new WindSession();
     		return $session->get('verifycode');*/
 }
开发者ID:latticet,项目名称:EduSoho_jb51,代码行数:7,代码来源:PwVerifyCode.php

示例13: getVisitor

 /**
  * 获取本地的访问标记
  * 
  * @param $isRefresh  bool 是否强制刷新
  * @return bool|array
  */
 public function getVisitor($isRefresh = false)
 {
     $sign = Pw::getCookie('visitor');
     if (empty($sign)) {
         return true;
     }
     $sign = Pw::decrypt($sign);
     $signs = explode('_', $sign);
     if ($isRefresh) {
         return $signs;
     }
     list($ip, $createdTime, $modifyTime) = $signs;
     $modifyTime = (int) $modifyTime;
     $createdTime = (int) $createdTime;
     if ($createdTime < 1 || $modifyTime < 1) {
         return true;
     }
     $onlineTime = $this->time - $modifyTime;
     if ($createdTime == $modifyTime && $onlineTime >= $this->isVisitorTime) {
         return $signs;
     }
     if ($onlineTime >= $this->spaceTime) {
         return $signs;
     }
     return false;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:32,代码来源:PwOnlineService.php

示例14: logout

 /**
  * 钩子---用户退出触发
  */
 public function logout($loginUser)
 {
     return true;
     $uid = intval($loginUser->uid);
     if ($uid < 1) {
         return false;
     }
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     if (!$sessionId) {
         return false;
     }
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     $sessionData = $sessionInfo['sessiondata'];
     $type = $sessionData['type'];
     if (!$sessionData || !$this->_getAccountTypeService()->checkType($type)) {
         return false;
     }
     if (!$this->_getAccountBindDs()->getByUidAndType($uid, $type)) {
         return false;
     }
     $host = $this->getHost();
     return $this->_getAccountService($type)->logout($host);
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:26,代码来源:App_Account_CommonService.php

示例15: _initUser

 /**
  * 初始话当前用户
  */
 protected function _initUser()
 {
     $_cOnlinetime = Wekit::C('site', 'onlinetime') * 60;
     if (!($lastvisit = Pw::getCookie('lastvisit'))) {
         $this->onlinetime = 0;
         $this->lastvisit = WEKIT_TIMESTAMP;
         $this->lastRequestUri = '';
     } else {
         list($this->onlinetime, $this->lastvisit, $this->lastRequestUri) = explode("\t", $lastvisit);
         ($onlinetime = WEKIT_TIMESTAMP - $this->lastvisit) < $_cOnlinetime && ($this->onlinetime += $onlinetime);
     }
     $user = $this->getLoginUser();
     if ($user->isExists() && WEKIT_TIMESTAMP - $user->info['lastvisit'] > min(1800, $_cOnlinetime)) {
         Wind::import('SRV:user.dm.PwUserInfoDm');
         $dm = new PwUserInfoDm($user->uid);
         $dm->setLastvisit(WEKIT_TIMESTAMP)->setLastActiveTime(WEKIT_TIMESTAMP);
         if ($this->onlinetime > 0) {
             $dm->addOnline($this->onlinetime > $_cOnlinetime * 1.2 ? $_cOnlinetime : $this->onlinetime);
         }
         Wekit::load('user.PwUser')->editUser($dm, PwUser::FETCH_DATA);
         $this->onlinetime = 0;
     }
     Pw::setCookie('lastvisit', $this->onlinetime . "\t" . WEKIT_TIMESTAMP . "\t" . $this->requestUri, 31536000);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:27,代码来源:phpwindBoot.php


注:本文中的Pw::getCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。