我是 PHP 的初学者,我的问题就像我的表单字段已经填充了 root 和密码,即使没有输入任何内容......请帮助......
<?php
$host="localhost";
$user="root";
$pass="****";
$db="test123";
mysqli_connect($host,$user,$pass);
mysqli_select_db($db);
if(isset($_POST['username']));
{
$username=$_POST['usern'];
$password=$_POST['passw'];
$qry="SELECT * FROM users WHERE name='".$username."'
AND password='".$password."' LIMIT 1 ";
$res=mysql_query($qry);
if(mysqli_stmt_num_rows($res)==1 )
{
echo"You have successfully logged in";
exit();
}
else{
echo"invalid login information";
exit();
}
}
?>
<!doctype html>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="login.php">Username:
<input type="text" name="usern">
<br />
<br />Password:
<input type="password" name="passw">
<br />
<br />
<input type="submit" value="Log In" />
</form>
</body>
</html>
..................................................... …………
OP:用户名:root密码:*