Redesign login validation

-Move validation code to validation.php
-Clean up various code