added code for writing config file

Now running the install script should write the database login details
to a new config.php file (creating a new file and writing it that way
seems easiest). Once the actual SQL script is in, I should move this so
it only does it if the DB query is successful, or I could reload the
page with a different state flag to avoid code duplication.