Spaces:
Sleeping
Sleeping
Kush-Singh-26
synced backend and frontend, added more menu items, ui and admin page improvements
56fb0d1 Download api/admin_order_actions.php from Kush26/kiit-kaffe: direct link, hf CLI and curl.
- Browser
- Download file 606 Bytes
-
https://huggingface.co/spaces/Kush26/kiit-kaffe/resolve/main/api/admin_order_actions.php
- Command line
-
hf download hf://spaces/Kush26/kiit-kaffe/api/admin_order_actions.php
-
curl -L -o admin_order_actions.php https://huggingface.co/spaces/Kush26/kiit-kaffe/resolve/main/api/admin_order_actions.php
606 Bytes
| header("Content-Type: application/json"); | |
| include "db.php"; | |
| $action = $_POST["action"] ?? ""; | |
| if ($action === "update_status") { | |
| $order_id = $_POST["order_id"]; | |
| $status = $_POST["status"]; | |
| $stmt = $conn->prepare("UPDATE orders SET status = ? WHERE id = ?"); | |
| if ($stmt->execute([$status, $order_id])) { | |
| echo json_encode(["status" => "success", "message" => "Status updated to $status"]); | |
| } else { | |
| echo json_encode(["status" => "error", "message" => "Update failed"]); | |
| } | |
| exit; | |
| } | |
| echo json_encode(["status" => "error", "message" => "Invalid action"]); | |