First thing I'd check is for leading or trailing spaces in both the table columns and the $username/$password
variables.
You can examine leading or trailing spaces in the DB with something like:
select *
from superhidden
where username like ' %'
or username like '% '
or password like ' %'
or password like '% '
You can use var_dump
for examining the variables.
And, of course, the near-obligatory remarks on almost all PHP/MySQL questions:
- The
mysql_*
functions are deprecated, you should be using one of the newer APIs.
- Use of user input without sanitisation is a bad idea. You should make sure both
$username
and $password
cannot be used for SQL injection attacks. Search for parameterised queries or SQL injection for more detail.
It's also generally a bad idea to store passwords in plain text, as evidenced by the rather large number of data "thefts", the latest of which was Target in the USA with some 70 million customers affected. There's a good QA here which provides some guidance.