* User: Matt Leering * Date: 2016-01-30 * Time: 12:04 AM */ require_once '../lib/classes/DBConnection.php'; require_once '../lib/classes/ClassTemplate.php'; if (!isset($_POST['serverType']) || !isset($_POST['serverAddress']) || empty($_POST['serverAddress']) || !isset($_POST['serverUsername']) || empty($_POST['serverUsername']) || !isset($_POST['serverPassword']) || empty($_POST['serverPassword']) || !isset($_POST['serverDatabase']) || empty($_POST['serverDatabase'])) { header('HTTP/1.1 500 Insufficient Parameters Passed'); header('Content-Type: application/json; charset=UTF-8'); exit; } //create a new database connection $connection = new DB_Connection($_POST['serverType'], $_POST['serverAddress'], $_POST['serverUsername'], $_POST['serverPassword'], $_POST['serverDatabase']); $success = false; $msg = ""; $link = $connection->AttemptConnection(); //Ensure that any failed connection attempts get reported to the user if (!$link || !empty($connection->GetLastErrorMessage())) { header('HTTP/1.1 500 Connection Failed: ' . $connection->GetLastErrorMessage()); header('Content-Type: application/json; charset=UTF-8'); exit; } switch ($_POST['action']) { //During the action of switching to the table tab we will be looking up a list of tables, and populating a select control with them case 'table': $tableList = ""; //Connection was successful. Start building HTML that will replace a currently empty div $success = true; $options = $connection->returnTableNameOptions(); $success = $options && !empty($options); if (!$success) {