You don't need brackets on an if statement. They are optional. You only need them if you want more then 1 line within the if statement. I believe the error is on the header redirect. I have noticed some funky things with it before but never been able to pinpoint it exactly.