fixed bugs on user authentication, also some literal mistakes in the PHP template