联系官方销售客服

1835022288

028-61286886

求助 版主:官方研发技术组
md5() 加密的 怎么提示密码错误
类型:迅睿CMS 更新时间:2021-08-31 17:08:38

会员中心做的密码修改  通过 md5() 加密的 怎么提示密码错误

\Phpcmf\Service::M()->table('member')->update($uid,[


   'password'  => md5(dr_safe_password($post['password'])),

]);


回帖
  • 官方研发技术-陈老师
    #1楼    官方研发技术-陈老师
    2021-08-31 16:47:05
    Chrome 0
    错了的,应该这样写
    \Phpcmf\Service::M('member')->edit_password(dr_member_info($uid), $post['password']);
  • 无
    #2楼    无
    2021-08-31 16:58:43
    Chrome 0
    官方研发技术-陈老师 好像不行 ,修改的是 当前登录账号下的某个子账号的密码
    dr_safe_password($post['password'])
    会员中心修改列表

    具体修改页面

  • 无
    #3楼    无
    2021-08-31 16:59:42
    Chrome 0
    官方研发技术-陈老师
    public function edit(){
    
        $uid = \Phpcmf\Service::L('input')->get('id');  //会员id
        $hr = dr_member_info($uid); //获取会员信息
    
        // 初始化自定义字段类
        \Phpcmf\Service::L('field')->app(APP_DIR);
    
    
        //获取该组可用字段
        $field = [];
        if ($this->member_cache['field'] && $hr['groupid']) {
            $fieldid = [];
    
            foreach ($hr['groupid'] as $gid) {
                $this->member_cache['group'][$gid]['field'] && $fieldid = dr_array2array($fieldid, $this->member_cache['group'][$gid]['field']);
            }
            if ($fieldid) {
                foreach ($this->member_cache['field'] as $fname => $t) {
                    in_array($fname, $fieldid) && $field[$fname] = $t;
                }
            }
        }
    
        if (IS_POST) {
    
            $post = \Phpcmf\Service::L('input')->post('data');
    
            \Phpcmf\Hooks::trigger('member_edit_before', $post);
            list($data, $return, $attach) = \Phpcmf\Service::L('form')->id($uid)->validation($post, null, $field, $hr);
            // 输出错误
            if ($return) {
                $this->_json(0, $return['error'], ['field' => $return['name']]);
            }
            $data[1]['is_complete'] = 1;
    
            \Phpcmf\Service::M()->table('member')->update($uid,[
                'name'      => $post['username'],
                'username'  => $post['username'],
                'email'     => $post['email'],
                'phone'     => $post['phone'],
                'hrpwd'     => $post['password'],
                'password'  => md5(dr_safe_password($post['password'])),
            ]);
            \Phpcmf\Service::M()->table('member_data')->update($uid, $data[1]);
            // 附件归档
            SYS_ATTACHMENT_DB && $attach && \Phpcmf\Service::M('Attachment')->handle(
                $uid,
                \Phpcmf\Service::M()->dbprefix('member').'-'.$uid,
                $attach
            );
            \Phpcmf\Hooks::trigger('member_edit_after', $data[1]);
            \Phpcmf\Service::L('cache')->del_data('member-info-'.$uid);
            \Phpcmf\Service::L('cache')->del_data('member-info-name-'.$hr['username']);
            $this->_json(1, dr_lang('保存成功'), IS_API_HTTP ? \Phpcmf\Service::M('member')->get_member($uid) : []);
    
        }
    
        \Phpcmf\Service::V()->assign([
            'form'     => dr_form_hidden(),
            'field'    => $field,
            'hr'       => $hr,
            'myfield'  => \Phpcmf\Service::L('field')->toform($uid, $field, $hr),
        ]);
    
        \Phpcmf\Service::V()->display('agent_edit_'.get_member_groupid($this->member['groupid']).'.html');
    }
  • 官方研发技术-陈老师
    #4楼    官方研发技术-陈老师
    2021-08-31 17:00:38
    Chrome 0
    只要传入uid和新密码就可以了,我们二开都是这么写的
  • 官方研发技术-陈老师
    #5楼    官方研发技术-陈老师
    2021-08-31 17:01:51
    Chrome 0
    public function edit(){
    
        $uid = \Phpcmf\Service::L('input')->get('id');  //会员id
        $hr = dr_member_info($uid); //获取会员信息
    
        // 初始化自定义字段类
        \Phpcmf\Service::L('field')->app(APP_DIR);
    
    
        //获取该组可用字段
        $field = [];
        if ($this->member_cache['field'] && $hr['groupid']) {
            $fieldid = [];
    
            foreach ($hr['groupid'] as $gid) {
                $this->member_cache['group'][$gid]['field'] && $fieldid = dr_array2array($fieldid, $this->member_cache['group'][$gid]['field']);
            }
            if ($fieldid) {
                foreach ($this->member_cache['field'] as $fname => $t) {
                    in_array($fname, $fieldid) && $field[$fname] = $t;
                }
            }
        }
    
        if (IS_POST) {
    
            $post = \Phpcmf\Service::L('input')->post('data');
    
            \Phpcmf\Hooks::trigger('member_edit_before', $post);
            list($data, $return, $attach) = \Phpcmf\Service::L('form')->id($uid)->validation($post, null, $field, $hr);
            // 输出错误
            if ($return) {
                $this->_json(0, $return['error'], ['field' => $return['name']]);
            }
            $data[1]['is_complete'] = 1;
    
            \Phpcmf\Service::M()->table('member')->update($uid,[
                'name'      => $post['username'],
                'username'  => $post['username'],
                'email'     => $post['email'],
                'phone'     => $post['phone'],
                'hrpwd'     => $post['password'],
            ]);
            \Phpcmf\Service::M('member')->edit_password(dr_member_info($uid), $post['password']);
            \Phpcmf\Service::M()->table('member_data')->update($uid, $data[1]);
            // 附件归档
            SYS_ATTACHMENT_DB && $attach && \Phpcmf\Service::M('Attachment')->handle(
                $uid,
                \Phpcmf\Service::M()->dbprefix('member').'-'.$uid,
                $attach
            );
            \Phpcmf\Hooks::trigger('member_edit_after', $data[1]);
            \Phpcmf\Service::L('cache')->del_data('member-info-'.$uid);
            \Phpcmf\Service::L('cache')->del_data('member-info-name-'.$hr['username']);
            $this->_json(1, dr_lang('保存成功'), IS_API_HTTP ? \Phpcmf\Service::M('member')->get_member($uid) : []);
    
        }
    
        \Phpcmf\Service::V()->assign([
            'form'     => dr_form_hidden(),
            'field'    => $field,
            'hr'       => $hr,
            'myfield'  => \Phpcmf\Service::L('field')->toform($uid, $field, $hr),
        ]);
    
        \Phpcmf\Service::V()->display('agent_edit_'.get_member_groupid($this->member['groupid']).'.html');
    }
    满意答案
  • 无
    #6楼    无
    2021-08-31 17:08:38
    Chrome 0
    @官方研发技术-陈老师:欧了 多谢 ~~~~~~~~~~~~