And someone registers on the website or inserts a row: ['ajm113', '12345', 0].
When they attempt to login they will have no problem of course as long as they have the username correct, but when it comes to the password check, MySQL completely doesn't bother to check it. Someone can type in a password such as "2312asadfasfrer" and login into someone's account! D:
Here is my login script when someone hits the login button.
function HighLevelSecurityString($string)
{
return htmlentities(stripslashes(mysql_real_escape_string($string)));
}
$username = HighLevelSecurityString($_POST['user']);
$password = md5(HighLevelSecurityString($_POST['password1']));
$sql="SELECT * FROM UserList WHERE Username='$username' or email='$username' and Password='$password'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result) or die(mysql_error());
// Mysql_num_row is counting table row
$count=mysql_num_rows($result) or die(mysql_error());
if($count == 1)
{
$_SESSION['username'] = $row['Username'];
header("location:index.php");
}else{
echo"User not found!";
}
As you can tell, very straight forward code. I dont get any errors from MySQL, so I'm not sure how it could possibly return 1 result each time even if the password is completely wrong. What I find strikingly odd is that I'm getting a somewhat reversed effect for when I'm just trying to UPDATE a row. When I do something like. "UPDATE UserList Password='$newPassword' WHERE Username='$username' and Password='$currentPassword'"







