User Login interface written with thinkphp, but each time said the user name or password is not correct, solve?
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, ' username or password incorrect ');
}
}else{
$this->redirect (' Index/index ', ' ', 2, ' username or password cannot be empty! ');
}
}
$this->display ();
}
}
?>
I do not fill in the prompt my user name or password is incorrect, I fill in the correct also prompt me user name or password is not correct, do not know which problem, ask for answers.
Share to:
------Solution--------------------
TP has its own form verification method, why not?
If you still need to write your own base code in the framework, what do you do with frames?
------Solution--------------------
Only logical hints will cause you to be prompted with an incorrect password. There's no reason for that.
Either there is a problem with the post data, or there is a problem with the SQL. Print out post data and SQL statements to see.