无论我做什么,我总是得到“错误的用户名或密码”已经尝试了不同类型的解决方案,但没有任何帮助。
//header('Access-Control-Allow-Origin: *');
include('db.php');
// username and password sent from form
$myusername=$_POST['username'];
$mypassword=$_POST['password'];
// To protect MySQL injection
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
echo '{"type":"1",'.
'"item": "Logged In"'.
'}';
}
else {
echo '{"type": "0",'.
'"item":"Wrong Username or Password"'.
'}';
}
有人可以帮忙吗?提前谢谢你!