當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。