TP Framework (thinkphp) to achieve three login password error after locking the account function

Source: Internet
Author: User
This article mainly introduces the TP framework (thinkphp) to achieve three login password error after locking the account function, combined with an instance of the form of analysis based on thinkphp landing judgment, the operation of the flag bit operations to achieve the password account lockout function, the need for friends can refer to the next

The example of this article describes the TP framework (thinkphp) to achieve three login password error after the lock account function. Share to everyone for your reference, as follows:

Tables in the database require the number of bars with control data name,pwd,number

Every time you enter the wrong password, the number-1 in the database is equal to 0 o'clock lock

Public Function Login_do () {    //account    $username =$_post[' username ');    Password    $pwd =$_post[' pwd '];    $user =m (' table name ');    $list = $user->where ("Username= ' $username '")->find ();    $time =date ("Ymd", Time ());    if ($list [' num ']==0) {      if ($list [' Time ']!= $time + 1) {        $this->error ("Your account is locked");}    }    if ($list) {      if ($list [' pwd ']== $pwd) {        $data [' id ']= $list [' id '];        $data [' num ']=3;        $user->save ($data);        $this->success ("Landing Success");      } else{        $list [' num ']=--$list [' num '];        $data [' num ']= $list [' num '];        $data [' id ']= $list [' id '];        $data [' Time ']= $time;        $user->save ($data);        $this->error ("Password is wrong, you can also enter". $list [' num ']. " Times ");      }    } else{      $this->error ("account Error");}    }

The above is the whole content of this article, thank you for reading. Read more about topic.alibabacloud.com!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.