Moved login stuff to its own file

Moved login functions and equivalent function to their own file. Left
install.php just for installation of the db