<?
$configFile = "../config/theconfig.php";

// 1. Check if config file exists
if (!file_exists($configFile)) {
    header("Location: install/install.php");
    exit;
}

// 2. Include config file
include($configFile);

// 3. Validate DB connection
if (!isset($con) || !($con instanceof mysqli) || $con->connect_errno) {
    // If connection fails, send to installer
    header("Location: ../install/install.php");
    exit;
}

?>