欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

tp框架(thinkPHP)實(shí)現(xiàn)三次登陸密碼錯(cuò)誤之后鎖定賬號(hào)功能示例

 更新時(shí)間:2018年05月24日 11:57:51   作者:請(qǐng)叫我郝先生  
這篇文章主要介紹了tp框架(thinkPHP)實(shí)現(xiàn)三次登陸密碼錯(cuò)誤之后鎖定賬號(hào)功能,結(jié)合實(shí)例形式分析了基于thinkPHP登陸判斷、標(biāo)志位運(yùn)算等操作實(shí)現(xiàn)密碼賬號(hào)鎖定功能,需要的朋友可以參考下

本文實(shí)例講述了tp框架(thinkPHP)實(shí)現(xiàn)三次登陸密碼錯(cuò)誤之后鎖定賬號(hào)功能。分享給大家供大家參考,具體如下:

數(shù)據(jù)庫(kù)中的表需要有控制數(shù)據(jù)的條數(shù)name,pwd,number

每當(dāng)你輸入錯(cuò)誤的密碼時(shí)候,數(shù)據(jù)庫(kù)中的number-1,等于0時(shí)則鎖定

public function login_do(){
    //賬號(hào)
    $username=$_POST['username'];
    //密碼
    $pwd=$_POST['pwd'];
    $user=M('表名');
    $list=$user->where("username='$username'")->find();
    $time=date("Ymd",time());
    if($list['num']==0){
      if($list['time']!=$time+1){
        $this->error("您的賬號(hào)已被鎖定");
      }
    }
    if($list){
      if($list['pwd']==$pwd){
        $data['id']=$list['id'];
        $data['num']=3;
        $user->save($data);
        $this->success("登陸成功");
      }else{
        $list['num']=--$list['num'];
        $data['num']=$list['num'];
        $data['id']=$list['id'];
        $data['time']=$time;
        $user->save($data);
        $this->error("密碼錯(cuò)誤,還可以輸入".$list['num']."次");
      }
    }else{
      $this->error("賬號(hào)錯(cuò)誤");
    }
}

更多關(guān)于thinkPHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《ThinkPHP入門(mén)教程》、《thinkPHP模板操作技巧總結(jié)》、《ThinkPHP常用方法總結(jié)》、《codeigniter入門(mén)教程》、《CI(CodeIgniter)框架進(jìn)階教程》、《Zend FrameWork框架入門(mén)教程》及《PHP模板技術(shù)總結(jié)》。

希望本文所述對(duì)大家基于ThinkPHP框架的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論