有代码可以检查用户是否输入了正确的密码。
if (isset($_POST['userpassword']))
{
include('db.php');
//I have used the name passwordu instead of password in the database as well.
$query = "SELECT * FROM users WHERE username = '".$_REQUEST['username']."' AND passwordu = '".md5($_REQUEST['userpassword'])."';";
$result = mysql_query($query);
if ($result){ //THIS IS WHERE I FEEL THE ERROR IS
echo "Congratulations. You are now Logged in. You will be logged out when the Browser is closed.";
$_SESSION['logval'] = TRUE; //Sets the User Logged in for the complete session.
}
else echo "Sorry, You Entered Wrong Info.";
}
但是,即使输入了错误的密码,它也会接受登录。
这里有什么问题?
另外,如果我在概念上犯了错误,请告诉我检查用户是否输入了正确信息的正确方法。