update
This commit is contained in:
@@ -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!";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user