SELECT * FROM admins WHERE (user = '' OR '1'='1') AND (pass = '')
user = '' or '1' = '1' will always evaluate to true since 1 will always equal 1, regardless of what the user is. With OR, you only need one condition to evaluate to true for the statement to be evaluated as true.
This effectively makes the SQL query: SELECT * FROM admins WHERE TRUE AND pass = ''
With AND, you need both conditions to be true in order for a record to be returned. pass = '' will only evaluated to true for blank passwords, so that is correct.
I'm answering this one out-of-order since it will make the last response make more sense:
SELECT * FROM admins WHERE user = '' OR 1=1 OR '1'='1' AND pass = ''
How would that be interpreted?
http://dev.mysql.com/doc/refman/5.0/en/operator-precedence.htmlIn other words: SELECT * FROM admins WHERE user = '' OR 1=1 OR ('1'='1' AND pass = '')
SELECT * FROM admins WHERE user = '' OR 1=1 OR '1'='1' AND pass = ''
'1'='1' AND pass = '' will similarly evaluate to true only for users with blank passwords. However, consider how the additional OR changes the equation with the possibilities of blank usernames and passwords.
Non-Blank User, Blank Password: SELECT * FROM admins WHERE FALSE OR TRUE OR TRUE
Non-Blank User, Non-Blank Password: SELECT * FROM admins WHERE FALSE OR TRUE OR FALSE
Blank User, Blank Password: SELECT * FROM admins WHERE TRUE OR TRUE OR TRUE (Why bother with SQLi though? Just hit "submit"

)
Blank User, Non-Blank Password: SELECT * FROM admins WHERE TRUE OR TRUE OR FALSE
Both of those statements will now evaluate to true since only one condition has to be true.
What you are trying to do is make the AND pass = '' irrelevant, and you need an OR to do that. However, you can't just add another OR since your statement would then be SELECT * FROM admins WHERE user = '' OR 1=1 OR AND pass = '', which would cause your query to break. You could also do OR '1'='2' AND pass = '' and have it evaluate to false every time; it wouldn't matter since you already have a TRUE in a series of ORs, and you only need one.
Edit: Man, Hayabusa always manages to ninja a response in when I go on a rant. His name is well-deserved
