Add auth and login function.

Allows user to login using sha1 passwords with MySQL. Sessions managed
by PHP using cookies.

Will move session storage into MySQL database and salt password hashes
in future but the base is there for now.