This commit is contained in:
fencl
2024-01-02 12:56:43 +01:00
parent 11f54265c4
commit 386622df5d
1489 changed files with 196315 additions and 0 deletions

36
adf/saveData.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = json_decode(file_get_contents('php://input'), true);
// 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]);
} else {
echo json_encode(['error' => 'Invalid data format']);
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Kontrola existence souboru
$filePath = 'adf/sliderValue.json';
if (file_exists($filePath)) {
// Načtení obsahu souboru
$fileContent = file_get_contents($filePath);
// Odeslání obsahu zpět klientovi
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *'); // Povolení Cross-Origin požadavků
echo $fileContent;
} else {
echo json_encode(['error' => 'File not found']);
}
} else {
echo json_encode(['error' => 'Invalid request method']);
}
// Ladící výstup
error_log(print_r($_POST, true));
error_log(print_r($_FILES, true));
?>