function updateDBConnection(DB_Connection $conn) { global $config_db, $user; if ($conn->validateKey()) { if (checkDBConnectionTable()) { $sql = "UPDATE db_connections SET " . "Name = '" . $conn->getName() . "', " . "Desc = '" . $conn->getDesc() . "', " . "Server = '" . $conn->getServer() . "', " . "User = '******', " . "Password = '******', " . "Schema = '" . $conn->getSchema() . "', " . "Type = " . $conn->getType() . ", " . "updateDate = '" . date("Y-m-d") . "', " . "updatedBy = '" . $user->getEmail() . "'" . " WHERE id = " . $conn->getID(); // Execute SQL $config_db->exec($sql); // Reload Database Connections loadDBConnections(); } } }
$error = ""; include_once '../common/config.database.php'; include_once '../common/class.users.php'; include_once '../common/class.connection.php'; // Setup connection $conn = new DB_Connection(); // Setup if (isset($_SESSION['login_user'])) { InitializeConfig(); $user = getUser($_SESSION['login_user']); } else { header("Location: logout.php"); } // Test for Update if (isset($_GET['id'])) { loadDBConnections(); foreach ($db_conn as $gDB) { if ($gDB->getID() == $_GET['id']) { $conn = $gDB; } } } // Set Variables - Overwrite existing values if (isset($_POST['server'])) { $conn->setServer($_POST['server']); } if (isset($_POST['user'])) { $conn->setUser($_POST['user']); } if (isset($_POST['password'])) { $conn->setPassword($_POST['password']);