refactored log in codes and added a generic template for regular php pages