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.