Home > Article > Backend Development > php我做的登陆页面,账户密码明明没错,但总显示错误,帮忙看一下谢谢!
php
$_login=array();
if(isset($_POST['submit'])){
$_login['username']=_check_username($_POST['zh'],2,20);
$_login['password']=_check_password($_POST['mm'],6,18);
if(_fetch_array("SELECT * FROM userinfor WHERE username='{$_login['username']}' and password='{$_login['password']}'")){
header("Location:index.php");
}else{
echo "用户名错误或者密码错误";
}
}
两个函数
function _query($_sql){
if(!$result=mysql_query($_sql)){
exit('SQL执行失败');
}
return $result;
}
function _fetch_array($_sql){
return mysql_fetch_array(_query($_sql),MYSQL_ASSOC);
}