'software type is not supported'], 400); $instance = trim($_GET['instance']); if (!preg_match('/^[a-zA-Z0-9\.\-\_]+$/', $instance)) apiresult(['error' => 'instance parameter is not correctly formatted'], 400); $string = ''; foreach ($_POST as $k => $v) { if (trim($v) === '') continue; $string .= strtolower(trim($k)).'='.trim($v)."\n"; } $config_file = $GLOBALS['appconf']['data_dir'].'/instances/'.$software.'/'.$instance.'/config'; file_put_contents($config_file, $string); header('Location: '.$_SERVER['HTTP_REFERER']);