Fixed the login

Moved the php code up and and added a bracket
Fixed the login so that it will redirect