#after reading in the values if($username eq "" || $hashPassword == $null) { error(); }else{ #after comparing them to the actual passwords stored in $sth = $db->prepare(q{SELECT userid, password from user where userid = ?}) or die("usr prepare error: $!"); $usr->execute($username) or die("usr prepare error: $!"); while(@row = $sth->fetchrow_array){ if($username eq $row[0] && $hashPassword eq $row[1]) { #Go to the new page }elsif($username ne $row[0] || $hashPassword != $row[1]) { error(); }elsif($username eq $row[0] && $hashPassword != $row[1]) { error(); }elsif($username ne $row[0] && $hashPassword == $row[1]) { error(); }elsif($username ne $row[0] && $hashPassword != $row[1]) { error(); } }