Created database connection class

Before you run the website, open admin/config/db.config.php and change
the host, user and pass to your own. You can also change the dbname if
you really feel the need to.

If you load admin/index.php, the page will automatically create a
database with the required tables.

For the rest I cleaned up some messy codework.