connect_error) {
        include_once "header.inc";
        die($db->connect_error);
    }
    if (in_array(DB_SERVER, array("localhost", "127.0.0.1"))) {
        $host = "localhost";
    }
    else {
        $host = '%';
    }
    if (!$db->real_query("SET PASSWORD FOR 'web'@'{$host}' = PASSWORD('{$web_pwd}')")) {
        include_once "header.inc";
        die("DB Password change unsuccessful, ceasing further operation" . PHP_EOL . $db->error);
    }
    /* ---------------------------------
     * 	CREATE DB PASSWORD FILE
     * --------------------------------- */
    $salt    = null;
    $enc_pwd = null;
    if ($new_salt) {
        $salt    = base64_encode(openssl_random_pseudo_bytes(32));
        $enc_pwd = my_encrypt($web_pwd, $salt);
    }
    else {
        $enc_pwd = my_encrypt($web_pwd);
    }
    if (!file_put_contents(DOC_ROOT . "/" . PWD_FILE, $enc_pwd)) {
        die("Failed to save password");
    }
    if ($salt) {
        print "Successfully updated the password, please copy the following text to the constant 'SALT' in the config.inc file, then the connection to the database will be restored
{$salt}
";
        print "Home";
    }
    else {
        print "Successfully updated the password, click here to continue";
    }
}
else {
    ?>