You'll have to post the code for main.php for anyone to see what the problem is.
some tips
1. have you hashed the password but forgotten to hash the input when you try to login?
2. try echoing the post vars at the top of main.php to see what is being sent.