This commit is contained in:
fencl
2024-01-02 12:27:22 +01:00
parent ab2f2dad01
commit 7c0ef82d06
3 changed files with 29 additions and 26 deletions

View File

@@ -2,13 +2,19 @@
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = json_decode(file_get_contents('php://input'), true);
// Uložte hodnotu obličeje (a další data) na serveru
file_put_contents('adf/data.json', json_encode($data));
// Zkontrolovat, zda je klíč sliderValue v datech
if (isset($data['sliderValue'])) {
// Uložit hodnotu posuvníku na serveru
$filePath = 'adf/sliderValue.json';
file_put_contents($filePath, json_encode(['sliderValue' => $data['sliderValue']]));
echo json_encode(['success' => true]);
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => 'Invalid data format']);
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Kontrola existence souboru
$filePath = 'adf/data.json';
$filePath = 'adf/sliderValue.json';
if (file_exists($filePath)) {
// Načtení obsahu souboru
$fileContent = file_get_contents($filePath);
@@ -27,3 +33,4 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Ladící výstup
error_log(print_r($_POST, true));
error_log(print_r($_FILES, true));
?>