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


PHP Forum::checkPwd方法代码示例

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


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

示例1: sys_checkpwd

 /**
  * check id pwd
  * @param String $id
  * @param String $pwd
  * @param String $md5
  * @param String $ip
  * @return {v:true|false,pwd:}
  */
 public function sys_checkpwd()
 {
     @($id = trim($this->params['url']['id']));
     @($pwd = rawurldecode($this->params['url']['pwd']));
     @($md5 = intval(trim($this->params['url']['md5'])));
     @($ip = trim($this->params['url']['ip']));
     $md5 = $md5 == 1 ? true : false;
     $this->ByrSession->from = $ip == "" ? "0.0.0.0" : $ip;
     if ($md5) {
         if (Configure::read("cookie.encryption")) {
             $pwd = $this->ByrSession->decrypt($pwd);
         }
         $pwd = base64_decode($pwd);
     }
     $ret = array();
     if (Forum::checkPwd($id, $pwd, $md5, true)) {
         $ret['v'] = true;
         $pwd = base64_encode(User::getInstance($id)->md5passwd);
         if (Configure::read("cookie.encryption")) {
             $pwd = $this->ByrSession->encrypt($pwd);
         }
         $ret['pwd'] = rawurlencode($pwd);
     } else {
         $ret['v'] = false;
     }
     echo BYRJSON::encode($ret);
 }
开发者ID:tilitala,项目名称:nForum,代码行数:35,代码来源:wsapi_controller.php

示例2: getCurrentUser

 public static function getCurrentUser()
 {
     if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
         header('WWW-Authenticate: Basic realm="nForum API"');
         header('HTTP/1.0 401 Unauthorized');
         exit;
     }
     $id = trim($_SERVER['PHP_AUTH_USER']);
     $pwd = $_SERVER['PHP_AUTH_PW'];
     if (strtolower($id) === 'guest' || Forum::checkPwd($id, $pwd, false, true)) {
         return $id;
     }
     return false;
 }
开发者ID:tilitala,项目名称:nForum,代码行数:14,代码来源:basic_auth.php

示例3: ajax_passwd

 public function ajax_passwd()
 {
     if (!$this->RequestHandler->isPost()) {
         $this->error(ECode::$SYS_REQUESTERROR);
     }
     $this->requestLogin();
     $u = User::getInstance();
     if (isset($this->params['form']['name'])) {
         $name = $this->params['form']['name'];
         $name = nforum_iconv('UTF-8', $this->encoding, $name);
         //0 means modify forever
         if ($u->setName($name)) {
             $ret['ajax_code'] = ECode::$USER_NAMEOK;
             $this->set('no_html_data', $ret);
         } else {
             $this->error(ECode::$USER_NAMEERROR);
         }
     } else {
         if (isset($this->params['form']['pold']) && isset($this->params['form']['pnew1']) && isset($this->params['form']['pnew2'])) {
             $old = $this->params['form']['pold'];
             $new1 = $this->params['form']['pnew1'];
             $new2 = $this->params['form']['pnew2'];
             if ($new1 !== $new2) {
                 $this->error(ECode::$USER_PWDERROR);
             }
             if (!Forum::checkPwd($u->userid, $old, false, false)) {
                 $this->error(ECode::$USER_OLDPWDERROR);
             }
             if (!$u->setPwd($new1)) {
                 $this->error(ECode::$USER_PWDERROR);
             }
             $ret['ajax_code'] = ECode::$USER_PWDOK;
             $this->set('no_html_data', $ret);
         }
     }
 }
开发者ID:rainsun,项目名称:nForum,代码行数:36,代码来源:user_controller.php

示例4: login

 public function login($id, $pwd, $md5 = true, $cookieTime = null)
 {
     if ($this->isLogin || $this->isGuest) {
         Forum::kickUser();
     }
     $ret = Forum::checkBanIP($id, $this->from);
     switch ($ret) {
         case 1:
             throw new LoginException(ECode::$LOGIN_IPBAN);
             break;
         case 2:
             throw new LoginException(ECode::$LOGIN_EPOS);
             break;
         case 3:
             throw new LoginException(ECode::$LOGIN_ERROR);
             break;
     }
     if ($id != 'guest' && !Forum::checkPwd($id, $pwd, $md5, true)) {
         throw new LoginException(ECode::$LOGIN_ERROR);
     }
     $ret = Forum::setUser(true);
     switch ($ret) {
         case -1:
             throw new LoginException(ECode::$LOGIN_MULLOGIN);
         case 1:
             throw new LoginException(ECode::$LOGIN_MAX);
         case 3:
             throw new LoginException(ECode::$LOGIN_IDBAN);
         case 4:
             throw new LoginException(ECode::$LOGIN_IPBAN);
         case 5:
             throw new LoginException(ECode::$LOGIN_FREQUENT);
         case 7:
             throw new LoginException(ECode::$LOGIN_NOPOS);
     }
     User::update();
     $u = User::getInstance();
     $utmpkey = $u->utmpkey;
     $pass = base64_encode($u->md5passwd);
     if (Configure::read("cookie.encryption")) {
         $utmpkey = $this->encrypt($utmpkey);
         $pass = $this->encrypt($pass);
     }
     $this->isLogin = true;
     $this->Cookie->write("UTMPUSERID", $u->userid, false, $cookieTime);
     $this->Cookie->write("UTMPKEY", $utmpkey, false);
     $this->Cookie->write("UTMPNUM", $u->index, false);
     $this->Cookie->write("PASSWORD", $pass, false, $cookieTime);
 }
开发者ID:tilitala,项目名称:nForum,代码行数:49,代码来源:byr_session.php


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