. * * putxml.php * * Write an xml file in the data folder. * * @author Daniele Bonini * @copyrights (c) 2016, 2024, 5 Mode */ // // PARAMETER VALIDATION // $filename = filter_input(INPUT_POST, "f")??""; $filename = strip_tags($filename); if (preg_match("/burger\d\d\d\-o\-\d\d\d/", $filename)) { $filename = $filename . ".xml"; } else if (preg_match("/burger\d\d\d/", $filename)) { $filename = $filename . "-s.xml"; } else { exit(0); } $filepath = APP_DATA_PATH . PHP_SLASH . $filename; //chmod(APP_DATA_PATH . PHP_SLASH . $filename, 0777); $xmlStr = filter_input(INPUT_POST, "xml")??""; $xmlStr = strip_tags($xmlStr); file_put_contents($filepath, $xmlStr); echo json_encode([200, 'OK']);