User logon interface written in thinkphp, but the user name or password is incorrect.

Source: Internet
Author: User
The user logon interface written in thinkphp, but every time the user name or password is incorrect, how can this problem be solved? & Lt ;? Phpsession_start (); header ('content-Type: text/html; & nbsp; charset = utf-8 '); class & nbsp; user logon interface written by AdminA using thinkphp, but every time I say that the user name or password is incorrect, how can I solve it?
 Session_start ();
Header ('content-Type: text/html; charset = utf-8 ');
Class AdminAction extends Action {
Public function index (){
If (isset ($ _ POST ['username']) {
If (isset ($ _ POST ['username']) & isset ($ _ POST ['password']) {
$ Db = M ();
$ Select = $ db-> query ("select * from developers where username = ". $ POST ['username']. "and password = ". $ _ POST ['password']. "");
If ($ select ){
$ _ SESSION ['admin'] =_ _ POST ['username'];
$ This-> redirect ('index/Index', '', 2, 'user'. $ _ POST ['username']. 'login successful! ');
} Else {
$ This-> redirect ('index/Index', '', 2, 'incorrect username or password ');
}
} Else {
$ This-> redirect ('index/Index', '', 2, 'user name or password cannot be blank! ');
}
}
$ This-> display ();
}
}
?>

If you do not enter the correct user name or password, the system prompts that the user name or password is incorrect. Share:
------ Solution --------------------
Tp has its own form verification method. why not?
If you still need to write the basic code in the framework, what should you do with the framework?
------ Solution --------------------
Only the logic prompt will prompt you that the password is incorrect. can't you find the reason.
Either the post data is faulty or the SQL is faulty. print the post data and check the SQL statement.

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.