// If the test fails, they will told and will have to click the back button to correct it
    $installAndUpgrade->testConnection();
}
// Step 2 has been processed
if ($step == 3) {
    $newOrExisting = $_POST['newOrExisting'];
    // 'New' or 'Existing'
    $installAndUpgrade->setDbHost($_SESSION['dbhost']);
    $installAndUpgrade->setDbUser($_SESSION['dbuser']);
    $installAndUpgrade->setDbPass($_SESSION['dbpass']);
    $installAndUpgrade->createConnection();
    $dbToUse = "";
    if ($newOrExisting == "New") {
        // Create the database
        $dbToUse = $_POST['dbnameinput'];
        $installAndUpgrade->setDbase($dbToUse);
        $installAndUpgrade->createDatabase();
    } else {
        $dbToUse = $_POST['dbnameselect'];
        $installAndUpgrade->setDbase($dbToUse);
    }
    // Now connect to the database (new or existing)
    $installAndUpgrade->connectToDatabase();
    // Now create all the tables
    $installAndUpgrade->fullInstall();
    // Create config file
    $fh = fopen("config/class.Config.php", 'w');
    if (!$fh) {
        $fileError = 1;
    } else {
        $fileError = 0;
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
/**
 * Instead of putting each step on a separate page, each step will post back to this page and be
 * processed in the next step if it passes the previous step.
 */
define("ROOTDIR", dirname(__FILE__));
// Global Constant of root directory
require_once ROOTDIR . "/include/database/class.InstallAndUpgradeQueries.php";
require_once ROOTDIR . "/config/class.Config.php";
$config = new Config();
$installAndUpgrade = new InstallAndUpgradeQueries();
$installAndUpgrade->setDbHost($config->dbHostName);
$installAndUpgrade->setDbUser($config->dbUserName);
$installAndUpgrade->setDbPass($config->dbPassword);
$installAndUpgrade->setDbase($config->dbName);
$complete = false;
if (isset($_POST['submit'])) {
    $installAndUpgrade->createConnection();
    $installAndUpgrade->connectToDatabase();
    $upgradeVersion = $_POST['upgradeVersion'];
    // ---------------------------------------------------------------------------
    // UPGRADE FROM 2.2 TO ANY 3.0+ VERSION
    // ---------------------------------------------------------------------------
    // Upgrade from Version 2.2 to Version 3.0
    if ($upgradeVersion == "22to30") {
        $installAndUpgrade->upgradeTwoPointTwoToThree();
    }
    // Upgrade from Version 2.2 to Version 3.1
    if ($upgradeVersion == "22to31") {
        $installAndUpgrade->upgradeTwoPointTwoToThree();