I am building a simple login system, most of the code here is from a toturial I found online, why do I get the incorrect password error??(Password is correct!)
The password Is not encrypted!
Code:
<?php
$Lname = $_POST['Lname'];
$Lpass = $_POST['Lpass'];
// Connects to your Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("Acc") or die(mysql_error());
// makes sure they filled it in
if(!$Lname | ! $Lpass) {
die('You did not fill in a required field.');
}
$check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['Lname']."'")or die(mysql_error());
$checkpass = mysql_query("SELECT * FROM users WHERE password = '".$_POST['Lpass']."'")or die(mysql_error());
//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die('That user does not exist in our database. <a href=register.htm>Click Here to Register</a>');
}
//gives error if the password is wrong
if ($checkpass == $Lpass)
echo "<h1><b>$Lname</b>, you are logged in!</h1> <br /> <a href='/forum/www.google.com'>link</a>";
else
die('Incorrect password, please try again.');
?>
I'd appreciate your help.