这是一个登录系统。当我希望用户登录时,我希望它获取给定的密码并将其与给定行的“密码”列进行比较......在这种情况下$usernameinput
,但我使用的方法不起作用。有什么建议么?
<?php
$usernameinput = $_POST["uname"];
$passwordinput = $_POST["pass"];
if (empty($usernameinput))
{
echo "";
}
else
{
$con = mysql_connect("localhost","STUFFFFF","STUFFFFFF");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
这里是它选择的地方
mysql_select_db("STUFFFFF", $con);
$login = mysql_query("SELECT * FROM Users
WHERE Username='$usernameinput'");
while($row = mysql_fetch_array($result))
{
$matchpassword = $row['Password'];
}
}
if (empty($passwordinput))
{
echo "";
}
else
{
if ("$passwordinput"=="$matchpassword")
{
$sqlusername = $usernameinput;
echo "You were logged in successfully, now you can visit the site as $sqlusername. <br />";
}
else
{
echo "You have entered an incorrect password.";
}
}
?>
<form action="login.php" method="post">
Username: <input type="text" name="uname" /> <br />
Password: <input type="password" name="pass" /> <br />
<input value="Login" type="submit" />
</form>