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


PHP Pw::setCookie方法代码示例

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


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

示例1: loginAction

 /**
  * 登录入口
  */
 public function loginAction()
 {
     if ($this->uid) {
         $this->showError('已登录,请不要重复登录');
     }
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     if (!$sessionId || !App_Account_LoginSessionBo::getInstance($sessionId)->getSession()) {
         $sessionId = $this->_getLoginSessionService()->createLoginSession();
     }
     $this->_getLoginSessionService()->updateLoginSession($sessionId, array('httpReferer' => $this->urlReferer, 'type' => $this->type, 'action' => 'login'));
     Pw::setCookie($this->_getLoginSessionService()->getCookieName(), $sessionId, $this->_getLoginSessionService()->getCooieExpire());
     $url = $this->_getAccountService()->getAuthorizeURL($sessionId);
     if ($url instanceof PwError) {
         $this->showError($url->getError());
     }
     $this->setOutput($url, 'url');
     $this->setTemplate('login');
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:21,代码来源:IndexController.php

示例2: _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

示例3: signVisitor

 /**
  * 标记一个访问者
  * 
  * @param string $ip
  * @param int $createdTime
  * @param int $modifyTime
  */
 public function signVisitor($ip, $createdTime, $modifyTime, $extension = array())
 {
     $ip = ip2long($ip);
     $sign = Pw::encrypt($ip . '_' . $createdTime . '_' . $modifyTime . '_' . serialize($extension));
     return Pw::setCookie('visitor', $sign);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:13,代码来源:PwOnlineService.php

示例4: endAction

 /**
  * 结束
  */
 public function endAction()
 {
     list($upgrade, $back) = $this->_backSuccess();
     Wekit::load('hook.srv.PwHookRefresh')->refresh();
     Wekit::load('SRV:cache.srv.PwCacheUpdateService')->updateAll();
     Wekit::load('domain.srv.PwDomainService')->refreshTplCache();
     PwSystemHelper::log('upgrade success, current version: ' . 'phpwind ' . NEXT_VERSION . ' release ' . NEXT_RELEASE, $this->version);
     $this->_clear();
     Pw::setCookie('checkupgrade', '', -1);
     $this->setOutput(array('systeminfo' => 'phpwind ' . NEXT_VERSION . ' release ' . NEXT_RELEASE, 'back' => str_replace(ROOT_PATH, '', $back), 'upgrade' => str_replace(ROOT_PATH, '', $upgrade)));
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:14,代码来源:UpgradeController.php

示例5: _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

示例6: _saveVerifyCode

 private function _saveVerifyCode()
 {
     Wind::import('LIB:utility.verifycode.PwBaseCode');
     $code = WindConvert::convert(PwBaseCode::getCode(), Wekit::V('charset'), 'UTF-8');
     $code = Pw::encrypt(strtolower($code));
     //Wind::import('WIND:http.session.WindSession');
     Pw::setCookie('Pw_verify_code', $code, 3600);
     /*$session = new WindSession();
     		$session->set('verifycode', $code);*/
 }
开发者ID:latticet,项目名称:EduSoho_jb51,代码行数:10,代码来源:PwVerifyCode.php

示例7: verifyAction

 /**
  * 验证版块密码
  */
 public function verifyAction()
 {
     $fid = $this->getInput('fid');
     $password = $this->getInput('password', 'post');
     Wind::import('SRV:forum.bo.PwForumBo');
     $forum = new PwForumBo($fid);
     if (!$forum->isForum(true)) {
         $this->showError('BBS:forum.exists.not');
     }
     if (md5($password) != $forum->foruminfo['password']) {
         $this->showError('BBS:forum.password.error');
     }
     Pw::setCookie('fp_' . $fid, Pw::getPwdCode(md5($password)), 86400);
     $this->showMessage('success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:18,代码来源:ForumController.php

示例8: logout

 /**
  * 后台用户退出服务
  *
  * @return boolean
  */
 public function logout()
 {
     return Pw::setCookie($this->cookieName, '', -1);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:9,代码来源:AdminUserService.php

示例9: _initUser

 /**
  * 初始话当前用户
  */
 protected function _initUser()
 {
     $requestUri = Wind::getComponent('request')->getRequestUri();
     $_cOnlinetime = Wekit::C('site', 'onlinetime') * 60;
     if (!($lastvisit = Pw::getCookie('lastvisit'))) {
         $onlinetime = 0;
         $lastvisit = WEKIT_TIMESTAMP;
         $lastRequestUri = '';
     } else {
         list($onlinetime, $lastvisit, $lastRequestUri) = explode("\t", $lastvisit);
         ($thistime = WEKIT_TIMESTAMP - $lastvisit) < $_cOnlinetime && ($onlinetime += $thistime);
     }
     $user = $this->getLoginUser();
     if ($user->isExists()) {
         $today = Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d'));
         if ($user->info['lastvisit'] && $today > $user->info['lastvisit']) {
             /* @var $loginSrv PwLoginService */
             $loginSrv = Wekit::load('SRV:user.srv.PwLoginService');
             $loginSrv->welcome($user, Wind::getComponent('request')->getClientIp());
         } elseif (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 ($onlinetime > 0) {
                 $dm->addOnline($onlinetime > $_cOnlinetime * 1.2 ? $_cOnlinetime : $onlinetime);
             }
             Wekit::load('user.PwUser')->editUser($dm, PwUser::FETCH_DATA);
             $onlinetime = 0;
         }
     }
     Pw::setCookie('lastvisit', $onlinetime . "\t" . WEKIT_TIMESTAMP . "\t" . $requestUri, 31536000);
     $obj = new stdClass();
     $obj->lastvisit = $lastvisit;
     $obj->requestUri = $requestUri;
     $obj->lastRequestUri = $lastRequestUri;
     Wekit::setV('lastvist', $obj);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:40,代码来源:phpwindBoot.php

示例10: createIdentity

 /** 
  * 创建登录用户标识
  *
  * @param int $uid 用户ID
  * @param string $password 用户密码
  * @return boolean
  */
 public function createIdentity($uid, $password)
 {
     $identity = Pw::encrypt($uid . "\t" . Pw::getPwdCode($password));
     return Pw::setCookie('winduser', $identity, 31536000);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:12,代码来源:PwUserService.php

示例11: previewAction

 /**
  * 风格预览
  */
 public function previewAction()
 {
     $id = $this->getInput("styleid");
     $addons = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type');
     $style = $this->_styleDs()->getStyle($id);
     Pw::setCookie('style_preview', $style['alias'] . '|' . $style['style_type'], 20);
     $url = $addons[$style['style_type']][2];
     if ($style['style_type'] == 'space') {
         $url .= '?username=' . $this->loginUser->username;
     }
     /* else if ($style['style_type'] == 'forum') {
     			$forums = Wekit::load('forum.PwForum')->getForumOrderByType(false);
     			$url .= '?fid=' . key($forums);
     		} */
     $this->forwardRedirect(WindUrlHelper::createUrl($url, array(), '', 'pw'));
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:19,代码来源:StyleController.php

示例12: run

 /**
  * 帖子列表页
  */
 public function run()
 {
     $tab = $this->getInput('tab');
     $fid = intval($this->getInput('fid'));
     $type = intval($this->getInput('type', 'get'));
     //主题分类ID
     $page = $this->getInput('page', 'get');
     $orderby = $this->getInput('orderby', 'get');
     $pwforum = new PwForumBo($fid, true);
     if (!$pwforum->isForum()) {
         $this->showError('BBS:forum.exists.not');
     }
     if ($pwforum->allowVisit($this->loginUser) !== true) {
         $this->showError(array('BBS:forum.permissions.visit.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
     }
     if ($pwforum->forumset['jumpurl']) {
         $this->forwardRedirect($pwforum->forumset['jumpurl']);
     }
     if ($pwforum->foruminfo['password']) {
         if (!$this->loginUser->isExists()) {
             $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => $fid))));
         } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $fid)) {
             $this->forwardAction('bbs/forum/password', array('fid' => $fid));
         }
     }
     $isBM = $pwforum->isBM($this->loginUser->username);
     if ($operateThread = $this->loginUser->getPermission('operate_thread', $isBM, array())) {
         $operateThread = Pw::subArray($operateThread, array('topped', 'digest', 'highlight', 'up', 'copy', 'type', 'move', 'lock', 'down', 'delete', 'ban'));
     }
     $this->_initTopictypes($fid, $type);
     $threadList = new PwThreadList();
     $this->runHook('c_thread_run', $threadList);
     $threadList->setPage($page)->setPerpage($pwforum->forumset['threadperpage'] ? $pwforum->forumset['threadperpage'] : Wekit::C('bbs', 'thread.perpage'))->setIconNew($pwforum->foruminfo['newtime']);
     $defaultOrderby = $pwforum->forumset['threadorderby'] ? 'postdate' : 'lastpost';
     !$orderby && ($orderby = $defaultOrderby);
     if ($tab == 'digest') {
         Wind::import('SRV:forum.srv.threadList.PwDigestThread');
         $dataSource = new PwDigestThread($pwforum->fid, $type, $orderby);
     } elseif ($type) {
         Wind::import('SRV:forum.srv.threadList.PwSearchThread');
         $dataSource = new PwSearchThread($pwforum);
         $dataSource->setOrderby($orderby);
         $dataSource->setType($type, $this->_getSubTopictype($type));
     } elseif ($orderby == 'postdate') {
         Wind::import('SRV:forum.srv.threadList.PwNewForumThread');
         $dataSource = new PwNewForumThread($pwforum);
     } else {
         Wind::import('SRV:forum.srv.threadList.PwCommonThread');
         $dataSource = new PwCommonThread($pwforum);
     }
     $orderby != $defaultOrderby && $dataSource->setUrlArg('orderby', $orderby);
     $threadList->execute($dataSource);
     $this->setOutput($threadList, 'threadList');
     $this->setOutput($threadList->getList(), 'threaddb');
     $this->setOutput($fid, 'fid');
     $this->setOutput($type ? $type : null, 'type');
     $this->setOutput($tab, 'tab');
     $this->setOutput($pwforum, 'pwforum');
     $this->setOutput($pwforum->headguide(), 'headguide');
     $this->setOutput($threadList->icon, 'icon');
     $this->setOutput($threadList->uploadIcon, 'uploadIcon');
     $this->setOutput($operateThread, 'operateThread');
     $this->setOutput($pwforum->forumset['numofthreadtitle'] ? $pwforum->forumset['numofthreadtitle'] : 26, 'numofthreadtitle');
     $this->setOutput(!$this->loginUser->uid && !$this->allowPost($pwforum) ? ' J_qlogin_trigger' : '', 'postNeedLogin');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->maxPage, 'totalpage');
     $this->setOutput($defaultOrderby, 'defaultOrderby');
     $this->setOutput($orderby, 'orderby');
     $this->setOutput($threadList->getUrlArgs(), 'urlargs');
     $this->setOutput($this->_formatTopictype($type), 'topictypes');
     //版块风格
     if ($pwforum->foruminfo['style']) {
         $this->setTheme('forum', $pwforum->foruminfo['style']);
         //$this->addCompileDir($pwforum->foruminfo['style']);
     }
     //seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     if ($threadList->page <= 1) {
         if ($type) {
             PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.type.title'), '', $lang->getMessage('SEO:bbs.thread.run.type.description'));
         } else {
             PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.title'), '', $lang->getMessage('SEO:bbs.thread.run.description'));
         }
     }
     PwSeoBo::init('bbs', 'thread', $fid);
     PwSeoBo::set(array('{forumname}' => $pwforum->foruminfo['name'], '{forumdescription}' => Pw::substrs($pwforum->foruminfo['descrip'], 100, 0, false), '{classification}' => $this->_getSubTopictypeName($type), '{page}' => $threadList->page));
     Pw::setCookie('visit_referer', 'fid_' . $fid . '_page_' . $threadList->page, 300);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:94,代码来源:ThreadController.php

示例13: deleteToken

 public function deleteToken($tokenName)
 {
     return Pw::setCookie($tokenName, '', -1);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:4,代码来源:PwCsrfToken.php

示例14: createIdentity

 /** 
  * 创建登录用户标识
  *
  * @param int $uid 用户ID
  * @param string $password 用户密码
  * @param int $rememberme 是否采用记住当前用户,记住则保存1年
  * @return boolean
  */
 public function createIdentity($uid, $password, $rememberme = 0)
 {
     $identity = Pw::encrypt($uid . "\t" . Pw::getPwdCode($password));
     return Pw::setCookie('winduser', $identity, $rememberme ? 31536000 : NULL);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:13,代码来源:PwUserService.php

示例15: _saveVerifyCode

 private function _saveVerifyCode()
 {
     Wind::import('LIB:utility.verifycode.PwBaseCode');
     $code = WindConvert::convert(PwBaseCode::getCode(), Wekit::V('charset'), 'UTF-8');
     $code = Pw::encrypt(strtolower($code), $this->_config['key']);
     //
     $verify_session_id = Pw::getCookie('Pw_verify_code');
     if (!$verify_session_id) {
         $verify_session_id = md5($code);
         Pw::setCookie('Pw_verify_code', md5($code), 3600);
     }
     //session 保存验证码
     Wind::import('WIND:http.session.WindSession');
     $session = new WindSession();
     $session->set('verifycode', $code);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:16,代码来源:PwVerifyCode.php


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