php 找回密码功能,找回密码类

~~~

/**

* 找回密码_步骤

** 判断帐号类型

** 手机发送验证码||邮箱发送验证码

** 修改密码

**/

public function findpass()

{

$step = I('get.step');

if($step == 1 || $step == null || !$step){ //step1

if(IS_POST){

$account = I('post.account') ? trim(I('post.account')) : '';

if(!$account) $this->error('帐号不能为空!');

$M = M('member');

//验证帐号是否存在

$Account = $M->field('mtel,email')->where(" mtel = '$account' or email = '$account' ")->select();

if(!$Account) $this->error('账户未注册');

$this->assign('account',$account);

$type = 0; //账号类型:0空,1手机,-1邮箱

//分辨帐号类型

if(preg_match('/^1[3456789]\d{9}$/',$account)) $type = 1;

if(preg_match('/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/',$account)) $type = -1;

//跳转步骤二

$this->assign('type',$type);

$this->step = 2;

$this->display();

}else{ //!IS_POST

$this->step = 1;

$this->display();

}

}elseif($step == 2 ){ //step2

if(IS_POST){

$account = I('post.account') ? trim(I('post.account')) : '';

$code = I('post.code') ? trim(I('post.code')) : '';

if(!$code) $this->error('验证码不能为空!');

if(!$account) $this->error('帐号不能为空!');

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值