Files
004_comission/_resources/it114105/itp4506/Assignment/19-20/jsonDB/update.php
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

18 lines
565 B
PHP

<?php
if(isset($_POST["fav"])){
$jsonCustomer = $_POST["dataCus"];
print($jsonCustomer);
$jsonCustomerPath = $_POST["dataEmail"].".json";
print($jsonCustomerPath);
file_put_contents($jsonCustomerPath, $jsonCustomer);
}else{
$jsonAdmin = $_POST["dataAdmin"];
$jsonCustomer = $_POST["dataCus"];
$jsonAdminPath = "adminCustomer.json";
file_put_contents($jsonAdminPath, $jsonAdmin);
$jsonCustomerPath = $_POST["dataEmail"].".json";
fopen($jsonCustomerPath, "w");
file_put_contents($jsonCustomerPath, $jsonCustomer);
}
?>