Added proper database authentication.

This commit enables the use of an actual MySQL database for
authentication. It expects an 'user' table of the format (user varchar,
pass varchar, privileges int).

'pass' is a bcrypted hash of the password.

'privileges' is an int between 0 and 5 where:
0-1 = No permissions
2-3 = Source permissions
4-5 = Admin permissions