當前位置: 首頁>>代碼示例>>PHP>>正文


PHP think_ucenter_md5函數代碼示例

本文整理匯總了PHP中think_ucenter_md5函數的典型用法代碼示例。如果您正苦於以下問題:PHP think_ucenter_md5函數的具體用法?PHP think_ucenter_md5怎麽用?PHP think_ucenter_md5使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了think_ucenter_md5函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: login

 /**
  * 登錄
  * @return 用戶對象 -2 密碼錯誤 -1 用戶不存在或被禁用
  */
 public function login($username, $password)
 {
     $map = array('username' => $username);
     $user = D('UcenterMember')->where($map)->find();
     if (is_array($user) && $user['status'] == 1) {
         /* 驗證用戶密碼 */
         if (think_ucenter_md5($password, UC_AUTH_KEY) === $user['password']) {
             $this->updateLogin($user['id']);
             //更新用戶登錄信息
             $uid = $user['id'];
             //登錄成功,返回用戶ID
         } else {
             $uid = -2;
             //密碼錯誤
         }
     } else {
         $uid = -1;
         //用戶不存在或被禁用
     }
     if ($uid > 0) {
         $admin = $this->where(array('member_id' => $uid))->find();
         if (is_array($admin) && $admin['status'] == 1) {
             return $admin;
         } else {
             $uid = -1;
             //用戶不存在或被禁用
         }
     }
     return $uid;
 }
開發者ID:netsnail,項目名稱:201507guoshu,代碼行數:34,代碼來源:UcenterAdminModel.class.php

示例2: addUser

 /**
  * 添加管理員
  * @param string $username
  * @param string $password
  * @return boolean|\Think\mixed
  * @author frenlee <frenlee@163.com>
  * @since 2015年5月13日 上午10:35:20
  */
 public function addUser($username = '', $password = '')
 {
     if (empty($username) || empty($password)) {
         return false;
     }
     $data = $this->create();
     $data['username'] = $username;
     $data['password'] = think_ucenter_md5($username, AUTH_KEY);
     return $this->add($data);
 }
開發者ID:skyling,項目名稱:bookz,代碼行數:18,代碼來源:AdminModel.class.php

示例3: login

 public function login($email, $password)
 {
     $map = array();
     $map['email'] = $email;
     $user = $this->where($map)->find();
     if (is_array($user) && $user['status']) {
         if (think_ucenter_md5($password, ADMIN_AUTH_KEY) === $user['password']) {
             $this->autoLogin($user);
             return $user['id'];
             return -2;
         }
     } else {
         return -1;
     }
 }
開發者ID:nullog,項目名稱:zhanglubao,代碼行數:15,代碼來源:AdminAdminModel.class.php

示例4: changepwd1

 public function changepwd1()
 {
     if (IS_POST) {
         $arr = I('post.');
         if (!$arr['password'] || !$arr['token'] || !$arr['str']) {
             $this->apiError(0, '參數錯誤');
         }
         if (!$this->checkEncrypt($arr['token'], $arr['str'])) {
             $this->apiError(0, '非法請求');
         }
         $data['password'] = think_ucenter_md5($arr['password'], UC_AUTH_KEY);
         $data['id'] = $this->uid;
         $data['update_time'] = time();
         $res = M('ucenter_member')->save($data);
         if ($res['status']) {
             $this->apiSuccess('success');
         } else {
             $this->apiError(0, '修改失敗');
         }
     }
 }
開發者ID:fengyeno,項目名稱:fille,代碼行數:21,代碼來源:UcenterController.class.php

示例5: think_ucenter_md5

<?php

include_once './Application/User/Conf/config.php';
function think_ucenter_md5($str, $key = 'ThinkUCenter')
{
    return '' === $str ? '' : md5(sha1($str) . $key);
}
echo think_ucenter_md5($_GET['password'], UC_AUTH_KEY);
開發者ID:PHPKnife,項目名稱:OneThink,代碼行數:8,代碼來源:password.php

示例6: verifyUser

 /**
  * 驗證用戶密碼
  * @param int    $uid 用戶id
  * @param string $password_in 密碼
  * @return true 驗證成功,false 驗證失敗
  * @author huajie <banhuajie@163.com>
  */
 public function verifyUser($uid, $password_in)
 {
     $password = $this->getFieldById($uid, 'password');
     if (think_ucenter_md5($password_in, UC_AUTH_KEY) === $password) {
         return true;
     }
     return false;
 }
開發者ID:admpub,項目名稱:OpenCenter,代碼行數:15,代碼來源:UcenterMemberModel.class.php

示例7: verifyUser

 /**
  * 驗證用戶密碼
  * @param int $uid 用戶id
  * @param string $user_pwd_in 密碼
  * @return true 驗證成功,false 驗證失敗
  * @author huajie <banhuajie@163.com>
  */
 protected function verifyUser($uid, $user_pwd_in)
 {
     $user_pwd = $this->getFieldById($uid, 'user_pwd');
     if (think_ucenter_md5($user_pwd_in, UC_AUTH_KEY) === $user_pwd) {
         return true;
     }
     return false;
 }
開發者ID:GuiFox,項目名稱:Morplee,代碼行數:15,代碼來源:UserModel.class.php

示例8: verifyUser

 /**
  * 驗證用戶密碼
  * @param int $uid 用戶id
  * @param string $password_in 密碼
  * @return true 驗證成功,false 驗證失敗
  * @author huajie <banhuajie@163.com>
  */
 protected function verifyUser($uid, $password_in)
 {
     $password = $this->where(array('id' => $uid))->getField('password');
     if (think_ucenter_md5($password_in, UC_AUTH_KEY) === $password) {
         return true;
     }
     return false;
 }
開發者ID:h136799711,項目名稱:201507banma,代碼行數:15,代碼來源:UcenterMemberModel.class.php

示例9: verifyUser

 /**
  * 驗證用戶密碼
  * @param int $uid 用戶id
  * @param string $password_in 密碼
  * @return true 驗證成功,false 驗證失敗
  * @author huajie <banhuajie@163.com>
  */
 protected function verifyUser($uid, $password_in)
 {
     $password = $this->getFieldById($uid, 'password');
     $salt = $this->getFieldById($uid, 'salt');
     if (!$salt) {
         $salt = UC_AUTH_KEY;
     }
     if (think_ucenter_md5($password_in, $salt) === $password) {
         return true;
     }
     return false;
 }
開發者ID:slpi1,項目名稱:onethinkTemplate,代碼行數:19,代碼來源:UcenterMemberModel.class.php

示例10: updatePsw

 /**
  * 更新密碼
  */
 public function updatePsw()
 {
     addLog("User/updatePsw", $_GET, $_POST, '應用' . $this->client_id . "調用更新密碼接口");
     //
     if (IS_POST) {
         $username = $this->_post('username', '');
         $old_psw = $this->_post('old_psw', '');
         $psw = $this->_post('psw', '');
         $code = $this->_post('code', '');
         if (empty($old_psw) && empty($code)) {
             $this->apiReturnErr("驗證參數缺失!");
         }
         //驗證碼存在時,排除密碼
         if (!empty($code)) {
             $old_psw = '';
         }
         $old_psw = base64_decode($old_psw);
         $psw = base64_decode($psw);
         $type = $this->getUsernameType($username);
         $result = array('status');
         if ($type == UcenterMemberModel::ACCOUNT_TYPE_MOBILE) {
             $result = apiCall(UserApi::FIND, array(array('mobile' => $username)));
         } elseif ($type == UcenterMemberModel::ACCOUNT_TYPE_USERNAME) {
             $result = apiCall(UserApi::FIND, array(array('username' => $username)));
         } else {
             $this->apiReturnErr("參數非法!");
         }
         if (!$result['status'] && empty($result['info'])) {
             $this->apiReturnErr("用戶登錄賬戶非法!");
         }
         $id = $result['info']['id'];
         addLog("id", $id, $psw, "");
         //**************檢測是否合法用戶,要修改密碼,必須確保用戶身份有權限******
         if (!empty($code)) {
             $type = SecurityCodeModel::TYPE_FOR_UPDATE_PSW;
             //
             $result = apiCall(SecurityCodeApi::IS_LEGAL_CODE, array($code, $username, $type));
             if (!$result['status'] || $result['info'] != 1) {
                 $this->apiReturnErr("驗證失敗");
             }
         } elseif (!empty($old_psw)) {
             if ($result['info']['password'] != think_ucenter_md5($old_psw, UC_AUTH_KEY)) {
                 $this->apiReturnErr("原密碼錯誤!");
             }
         }
         //**************************************************************
         if (strlen($psw) < 6) {
             $this->apiReturnErr("密碼必須大於6位長度!");
         }
         addLog("User/updatePsw", $_GET, $_POST, '應用' . $this->client_id . "調用更新密碼接口");
         $result = apiCall(UserApi::UPDATEPWD, array($id, $psw));
         //記錄成功更新密碼的日誌
         action_log("api_user_update_psw", "common_member", $id, $this->client_id);
         if (!$result['status']) {
             $this->apiReturnErr("更新密碼失敗!" . $result['info']);
         }
         $this->apiReturnSuc("更新密碼成功!");
     } else {
         $this->apiReturnErr("更新密碼失敗!");
     }
 }
開發者ID:h136799711,項目名稱:baseItboye,代碼行數:64,代碼來源:UserController.class.php

示例11: webscan_St0pAttack

                webscan_St0pAttack($key, $value, $filter, "GET");
            }
        }
        if (empty($id)) {
            $id = 0;
        }
        $id = preg_replace('#[^\\w\\s]#i', '', $id);
        if (strlen($username) > 20) {
            $username = substr($username, 0, 20);
        }
        if ($act == 'login') {
            $sql = "select * from admin where username='{$username}' or id='{$id}' or email = '{$email}'";
            $result = @mysql_fetch_array(mysql_query($sql));
            mysql_close();
            if ($result) {
                if (think_ucenter_md5($password, $result['salt']) === $result['password']) {
                    $_SESSION['login'] = 1;
                    $_SESSION['auth'] = 1;
                    echo "<center style=\"font-size:36px; color:red\"><a href=\"./sgbm/admin_index.php\">Click jump to the Backstage</a></center>";
                } else {
                    exit('<script>alert("Password of the account is not right")</script>');
                }
            } else {
                exit('<script>alert("The account is not exists")</script>');
            }
        } else {
            exit('<script>alert("Please login!login!login!login!login!login!login!login!login!login!login!login!")</script>');
        }
    }
} else {
    ?>
開發者ID:hxer,項目名稱:ctf,代碼行數:31,代碼來源:login.php

示例12: login

 /**
  * 登錄指定用戶
  * @param  integer $uid 用戶UID
  * @param  string  $mobile 用戶名
  * @param  string  $password 用戶密碼
  * @param bool $remember
  * @param int $role_id 有值代表強製登錄這個角色
  * @return boolean      ture-登錄成功,false-登錄失敗
  */
 public function login($uid, $mobile = '', $password = '', $remember = false, $role_id = 0)
 {
     /* 檢測是否在當前應用注冊 */
     $map['uid'] = $uid;
     $map['mobile'] = $mobile;
     /* 獲取用戶數據 */
     $user = $this->where($map)->find();
     if ($role_id != 0) {
         $user['last_login_role'] = $role_id;
     } else {
         if (!intval($user['last_login_role'])) {
             $user['last_login_role'] = $user['show_role'];
         }
     }
     $return = check_action_limit('input_password', 'ucuser', $user['uid'], $user['uid']);
     if ($return && !$return['state']) {
         return $return['info'];
     }
     if (is_array($user) && $user['status']) {
         /* 驗證用戶密碼 */
         if (think_ucenter_md5($password, UC_AUTH_KEY) === $user['password']) {
             $this->updateLogin($user['uid']);
             //更新用戶登錄信息
             return $user['uid'];
             //登錄成功,返回用戶UID
         } else {
             return -2;
             //密碼錯誤
         }
     } else {
         return -1;
         //用戶不存在或被禁用
     }
     //以下程序運行不到
     session('temp_login_uid', $uid);
     session('temp_login_role_id', $user['last_login_role']);
     if ($user['status'] == 3) {
         header('Content-Type:application/json; charset=utf-8');
         $data['status'] = 1;
         $data['url'] = U('Ucuser/Ucuser/activate');
         exit(json_encode($data));
     }
     if (1 > $user['status']) {
         $this->error = '用戶未激活或已禁用!';
         //應用級別禁用
         return false;
     }
     /* 登錄用戶 */
     $this->autoLogin($user, $remember);
     session('temp_login_uid', null);
     session('temp_login_role_id', null);
     return true;
 }
開發者ID:fishling,項目名稱:chatPro,代碼行數:62,代碼來源:UcuserModel.class.php

示例13: update

 /**
  * 修改密碼
  */
 public function update($param)
 {
     if ($param['old_password'] && $param['new_password'] && $param['uid']) {
         $map['uid'] = intval($param['uid']);
         $old_password = trim($param['old_password']);
         $user_info = M('ucenter_member')->where($map)->find();
         if ($user_info) {
             if (think_ucenter_md5($old_password, UC_AUTH_KEY) !== $user_info['password']) {
                 $this->getResponse('', '303');
             } else {
                 $save['password'] = think_ucenter_md5(trim($param['new_password']), UC_AUTH_KEY);
                 $res = M('ucenter_member')->where($map)->save($save);
                 $this->getResponse('', $res ? '0' : '304');
             }
         } else {
             $this->getResponse('', '301');
         }
     } else {
         $this->getResponse('', '999');
     }
 }
開發者ID:jayfjso,項目名稱:pinsen,代碼行數:24,代碼來源:user.php


注:本文中的think_ucenter_md5函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。