本文整理汇总了PHP中Pw::getPwdCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::getPwdCode方法的具体用法?PHP Pw::getPwdCode怎么用?PHP Pw::getPwdCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::getPwdCode方法的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');
}
示例2: _getUser
protected function _getUser()
{
$authkey = 'winduser';
$pre = Wekit::C('site', 'cookie.pre');
$pre && ($authkey = $pre . '_' . $authkey);
$winduser = $this->getInput($authkey, 'post');
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;
}
示例3: isLogin
public function isLogin($uid, $password)
{
$user = $this->loadUserService()->getUserByUid($uid);
if (!$user) {
return array();
}
if (Pw::getPwdCode($user['password']) != $password) {
return array();
}
$auth = Wekit::load('ADMIN:service.AdminAuth');
if (!$auth->findByUid($user['uid'])) {
return array();
}
return $user;
}
示例4: isLogin
public function isLogin($username, $password)
{
if (!$this->isFounder($username)) {
return array();
}
$founder = $this->getFounders();
list($md5pwd) = explode('|', $founder[$username], 2);
if (Pw::getPwdCode($md5pwd) != $password) {
return array();
}
if (!($user = $this->loadUserService()->getUserByName($username))) {
$user = array('uid' => 0, 'username' => $username, 'groupid' => 3);
}
return $user;
}
示例5: uploadAction
/**
* 本地安装 - 上传
*/
public function uploadAction()
{
$authkey = 'AdminUser';
$pre = Wekit::C('site', 'cookie.pre');
$pre && ($authkey = $pre . '_' . $authkey);
$winduser = $this->getInput($authkey, 'post');
if (!$winduser) {
$this->showError('login.not');
}
list($type, $u, $pwd) = explode("\t", Pw::decrypt(urldecode($winduser)));
if ($type == 'founder') {
$founders = Wekit::load('ADMIN:service.srv.AdminFounderService')->getFounders();
if (!isset($founders[$u])) {
$this->showError('login.not');
}
list($md5pwd, $salt) = explode('|', $founders[$u], 2);
if (Pw::getPwdCode($md5pwd) != $pwd) {
$this->showError('login.not');
}
} else {
$r = Wekit::load('user.PwUser')->getUserByUid($u);
if (!$r) {
$this->showError('login.not');
}
if (Pw::getPwdCode($r['password']) != $pwd) {
$this->showError('login.not');
}
}
Wind::import('SRC:applications.appcenter.service.srv.helper.PwApplicationUpload');
$upload = new PwApplicationUpload();
$upload->dir = Wind::getRealDir($this->_installService()->getConfig('tmp_dir'), true) . '/';
$uploaddb = $upload->execute();
if ($uploaddb instanceof PwError) {
$this->showError($uploaddb->getError());
}
if (empty($uploaddb)) {
$this->showError('upload.fail');
}
$this->setOutput(array('filename' => $uploaddb[0]['name'], 'file' => $uploaddb[0]['fileuploadurl']), 'data');
$this->showMessage('success');
}
示例6: _getLoginUser
/**
* 获得大概年前登录用户对象
*
* @return PwUserBo
*/
protected function _getLoginUser()
{
if (!($userCookie = Pw::getCookie('winduser'))) {
$uid = $password = '';
} else {
list($uid, $password) = explode("\t", Pw::decrypt($userCookie));
}
$user = new PwUserBo($uid);
if (!$user->isExists() || Pw::getPwdCode($user->info['password']) != $password) {
$user->reset();
} else {
unset($user->info['password']);
}
return $user;
}
示例7: login
/**
* 后台用户登录服务
*
* 后台用户登录服务,并返回用户对象.参数信息:<code>
* $loginInfo: AdminUser
* </code>
*
* @param string $username 用户名
* @param string $password 密码
* @return boolean
*/
public function login($username, $password)
{
$conf = $this->loadFounderService()->getFounders();
if (isset($conf[$username])) {
$r = $this->loadFounderService()->checkPwd($conf[$username], $password);
if (!$r) {
return new PwError('ADMIN:login.fail.user.illegal');
}
$cookie = Pw::encrypt(self::FOUNDER . "\t" . $username . "\t" . Pw::getPwdCode($r));
} else {
if (!$this->loadSafeService()->ipLegal(Wekit::app()->clientIp)) {
return new PwError('ADMIN:login.fail.ip');
}
$user = $this->loadUserService()->verifyUser($username, $password);
if ($user instanceof PwError) {
return new PwError('ADMIN:login.fail.user.illegal');
}
/* @var $auth AdminAuth */
$auth = Wekit::load('ADMIN:service.AdminAuth');
if (!$auth->findByUid($user['uid'])) {
return new PwError('ADMIN:login.fail.allow');
}
$u = $this->loadUserService()->getUserByUid($user['uid']);
$cookie = Pw::encrypt(self::USER . "\t" . $user['uid'] . "\t" . Pw::getPwdCode($u['password']));
}
Pw::setCookie($this->cookieName, $cookie, 1800);
return true;
}
示例8: 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');
}
示例9: 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);
}
示例10: run
/**
* 帖子阅读页
*/
public function run()
{
$tid = intval($this->getInput('tid'));
list($page, $uid, $desc) = $this->getInput(array('page', 'uid', 'desc'), 'get');
$threadDisplay = new PwThreadDisplay($tid, $this->loginUser);
$this->runHook('c_read_run', $threadDisplay);
if (($result = $threadDisplay->check()) !== true) {
$this->showError($result->getError());
}
$_cache = Wekit::cache()->fetch(array('level', 'group_right'));
$pwforum = $threadDisplay->getForum();
if ($pwforum->foruminfo['password']) {
if (!$this->loginUser->isExists()) {
$this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', 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 ($uid) {
Wind::import('SRV:forum.srv.threadDisplay.PwUserRead');
$dataSource = new PwUserRead($threadDisplay->thread, $uid);
} else {
Wind::import('SRV:forum.srv.threadDisplay.PwCommonRead');
$dataSource = new PwCommonRead($threadDisplay->thread);
}
$dataSource->setPage($page)->setPerpage($pwforum->forumset['readperpage'] ? $pwforum->forumset['readperpage'] : Wekit::C('bbs', 'read.perpage'))->setDesc($desc);
$threadDisplay->setImgLazy(Wekit::C('bbs', 'read.image_lazy'));
$threadDisplay->execute($dataSource);
$operateReply = $operateThread = array();
$isBM = $pwforum->isBM($this->loginUser->username);
if ($threadPermission = $this->loginUser->getPermission('operate_thread', $isBM, array())) {
$operateReply = Pw::subArray($threadPermission, array('toppedreply', 'remind', 'shield', 'delete', 'ban', 'inspect', 'read'));
$operateThread = Pw::subArray($threadPermission, array('digest', 'topped', 'up', 'highlight', 'copy', 'type', 'move', 'lock', 'down', 'delete', 'ban'));
}
$threadInfo = $threadDisplay->getThreadInfo();
$this->setOutput($threadDisplay, 'threadDisplay');
$this->setOutput($tid, 'tid');
$this->setOutput($threadDisplay->fid, 'fid');
$this->setOutput($threadInfo, 'threadInfo');
$this->setOutput($threadDisplay->getList(), 'readdb');
$this->setOutput($threadDisplay->getUsers(), 'users');
$this->setOutput($pwforum, 'pwforum');
$this->setOutput(PwCreditBo::getInstance(), 'creditBo');
$this->setOutput($threadDisplay->getHeadguide(), 'headguide');
$this->setOutput(Wekit::C('bbs', 'read.display_member_info'), 'displayMemberInfo');
$this->setOutput(Wekit::C('bbs', 'read.display_info'), 'displayInfo');
$this->setOutput(Wekit::C('bbs', 'thread.hotthread_replies'), 'hotIcon');
$this->setOutput($threadPermission, 'threadPermission');
$this->setOutput($operateThread, 'operateThread');
$this->setOutput($operateReply, 'operateReply');
$this->setOutput(!$this->loginUser->uid && !$this->allowPost($pwforum) ? ' J_qlogin_trigger' : '', 'postNeedLogin');
$this->setOutput(!$this->loginUser->uid && !$this->allowReply($pwforum) ? ' J_qlogin_trigger' : '', 'replyNeedLogin');
$this->setOutput($_cache['level']['ltitle'], 'ltitle');
$this->setOutput($_cache['level']['lpic'], 'lpic');
$this->setOutput($_cache['level']['lneed'], 'lneed');
$this->setOutput($_cache['group_right'], 'groupRight');
$this->setOutput($threadDisplay->page, 'page');
$this->setOutput($threadDisplay->perpage, 'perpage');
$this->setOutput($threadDisplay->total, 'count');
$this->setOutput($threadDisplay->maxpage, 'totalpage');
$this->setOutput($threadDisplay->getUrlArgs(), 'urlargs');
$this->setOutput($threadDisplay->getUrlArgs('desc'), 'urlDescArgs');
$this->setOutput($this->loginUser->getPermission('look_thread_log', $isBM, array()), 'canLook');
$this->setOutput($this->_getFpage($threadDisplay->fid), 'fpage');
//版块风格
if ($pwforum->foruminfo['style']) {
$this->setTheme('forum', $pwforum->foruminfo['style']);
//$this->addCompileDir($pwforum->foruminfo['style']);
}
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$threadDisplay->page <= 1 && $seoBo->setDefaultSeo($lang->getMessage('SEO:bbs.read.run.title'), '', $lang->getMessage('SEO:bbs.read.run.description'));
$seoBo->init('bbs', 'read');
$seoBo->set(array('{forumname}' => $threadDisplay->forum->foruminfo['name'], '{title}' => $threadDisplay->thread->info['subject'], '{description}' => Pw::substrs($threadDisplay->thread->info['content'], 100, 0, false), '{classfication}' => $threadDisplay->thread->info['topic_type'], '{tags}' => $threadInfo['tags'], '{page}' => $threadDisplay->page));
Wekit::setV('seo', $seoBo);
//是否显示回复
$showReply = true;
//锁定时间
if ($pwforum->forumset['locktime'] && $threadInfo['created_time'] + $pwforum->forumset['locktime'] * 86400 < Pw::getTime()) {
$showReply = false;
} elseif (Pw::getstatus($threadInfo['tpcstatus'], PwThread::STATUS_LOCKED) && !$this->loginUser->getPermission('reply_locked_threads')) {
$showReply = false;
}
$this->setOutput($showReply, 'showReply');
$this->runReadDesign($threadDisplay->fid);
$this->updateReadOnline($threadDisplay->fid, $tid);
}
示例11: createRegistIdentify
/**
* 构造用户标志
*
* @param int $uid 用户ID
* @param string $pwd 用户密码
* @return string
*/
public static function createRegistIdentify($uid, $pwd)
{
$code = Pw::encrypt($uid . "\t" . Pw::getPwdCode($pwd));
return rawurlencode($code);
}
示例12: _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;
}
示例13: createLoginIdentify
/**
* 创建登录标识
*
* @param array $userInfo 用户信息
* @return string
*/
public static function createLoginIdentify($userInfo)
{
$code = Pw::encrypt($userInfo['uid'] . "\t" . Pw::getPwdCode($userInfo['password']) . "\t" . Pw::getTime());
return rawurlencode($code);
}
示例14: sharePageAction
/**
* 分享到其它平台使用的链接
*
* @access public
* @return void
* @example
* <pre>
* /index.php?m=native&c=read&a=sharePage&tid=21
* </pre>
*/
public function sharePageAction()
{
$tid = intval($this->getInput('tid', 'get'));
list($page, $uid, $desc) = $this->getInput(array('page', 'uid', 'desc'), 'get');
$threadDisplay = new PwThreadDisplay($tid, $this->loginUser);
$this->runHook('c_read_run', $threadDisplay);
if (($result = $threadDisplay->check()) !== true) {
$this->showError($result->getError());
}
$_cache = Wekit::cache()->fetch(array('level', 'group_right'));
$pwforum = $threadDisplay->getForum();
if ($pwforum->foruminfo['password']) {
if (!$this->uid) {
$this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => ${$pwforum}->fid))));
} elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $pwforum->fid)) {
$this->forwardAction('bbs/forum/password', array('fid' => $pwforum->fid));
}
}
Wind::import('SRV:forum.srv.threadDisplay.PwCommonRead');
$dataSource = new PwCommonRead($threadDisplay->thread);
//数据分页
$perpage = $pwforum->forumset['readperpage'] ? $pwforum->forumset['readperpage'] : Wekit::C('bbs', 'read.perpage');
$dataSource->setPage($page)->setPerpage($perpage)->setDesc($desc);
$threadDisplay->setImgLazy(Wekit::C('bbs', 'read.image_lazy'));
$threadDisplay->execute($dataSource);
//主题的信息
$threadInfo = $threadDisplay->getThreadInfo();
$threadInfo['content'] = preg_replace('/onload="([^"]+)"/i', '', $threadInfo['content']);
$threadInfo['content'] = preg_replace('/onclick="([^"]+)"/i', '', $threadInfo['content']);
$threadInfo['content'] = str_replace('style="max-width:700px;"', '', $threadInfo['content']);
preg_match_all('/<div class="J_video" data-url="(.+?\\.swf.*?)".*?><\\/div>/i', $threadInfo['content'], $matches);
if (isset($matches[0]) && $matches[0]) {
$count = count($matches[0]);
for ($i = 0; $i < $count; $i++) {
$vedio = '<embed src="' . $matches[1][$i] . '" allowFullScreen="true" quality="high" width="240" height="200" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed><br>';
// echo $vedio."<br>";
$threadInfo['content'] = str_replace($matches[0][$i], $vedio, $threadInfo['content']);
}
}
//帖子内容音频资源
preg_match_all('/<div class="J_audio".*?data-url="(.+?)".*?><\\/div>/i', $threadInfo['content'], $matches);
if (isset($matches[0]) && $matches[0]) {
$count = count($matches[0]);
for ($i = 0; $i < $count; $i++) {
$audio = '<br><audio controls="controls" src="' . $matches[1][$i] . '">不支持音乐</audio><br>';
$threadInfo['content'] = str_replace($matches[0][$i], $audio, $threadInfo['content']);
}
}
//帖子数据列表
$threadList = $threadDisplay->getList();
$threadList = array_slice($threadList, 1, 3);
foreach ($threadList as $k => $v) {
preg_match_all('/<div class="J_video" data-url="(.+?\\.swf.*?)".*?><\\/div>/i', $v['content'], $matches);
if (isset($matches[0]) && $matches[0]) {
$count = count($matches[0]);
for ($i = 0; $i < $count; $i++) {
$vedio = '<embed src="' . $matches[1][$i] . '" allowFullScreen="true" quality="high" width="240" height="200" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed><br>';
// echo $vedio."<br>";
$threadList[$k]['content'] = str_replace($matches[0][$i], $vedio, $v['content']);
}
}
preg_match_all('/<div class="J_audio".*?data-url="(.+?)".*?><\\/div>/i', $v['content'], $matches);
if (isset($matches[0]) && $matches[0]) {
$count = count($matches[0]);
for ($i = 0; $i < $count; $i++) {
$audio = '<br><audio controls="controls" src="' . $matches[1][$i] . '">不支持音乐</audio><br>';
$threadList[$k]['content'] = str_replace($matches[0][$i], $audio, $v['content']);
}
}
}
//var_dump($threadList);exit;
$this->setOutput(Wekit::getGlobal('url', 'res'), 'resPath');
$this->setOutput($threadInfo, 'threadInfo');
$this->setOutput($threadList, 'threadList');
$this->setOutput($threadDisplay, 'threadDisplay');
$this->setOutput(PwCreditBo::getInstance(), 'creditBo');
}
示例15: 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);
}