This commit is contained in:
PaulVua
2025-01-24 10:43:34 +01:00
parent 155a2bd453
commit 833ed458a7
4 changed files with 79 additions and 38 deletions

View File

@@ -3,9 +3,19 @@ $type=$_GET['type'];
if ($type == "update_config") {
echo "updating....";
$param=$_GET['param'];
$value=$_GET['value'];
$configFile = '../config.json';
// Convert value to boolean, integer, or string
if ($value === "true") {
$value = true; // Convert "true" string to boolean true
} elseif ($value === "false") {
$value = false; // Convert "false" string to boolean false
} elseif (is_numeric($value)) {
$value = $value + 0; // Convert numeric strings to int or float
}
$configData = json_decode(file_get_contents($configFile), true);
$configData['loop_activation'] = true;
$configData[$param] = $value;
file_put_contents($configFile, json_encode($configData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
echo "Config updated!";
}