From 93024987cebdbbf6266771036b0a31fcf317858e Mon Sep 17 00:00:00 2001 From: JARVIS <68321889+jarvis-v3@users.noreply.github.com> Date: Fri, 29 Nov 2024 23:15:31 +0800 Subject: [PATCH] Create location.php Short Explanation of location.php Functionality: The location.php script is designed to handle incoming location data (latitude and longitude) from a client-side application. Data Reception: It checks if the latitude and longitude values are sent via a POST request. If they are present, it retrieves these values. Data Formatting: The script formats the received location data into a string that includes both latitude and longitude. Data Storage: It appends this formatted string to a file named locations.txt, allowing for the storage of multiple location entries over time. Response Generation: After successfully saving the data, the script sends back a JSON response indicating whether the operation was successful or if there was an error (e.g., if the location data was not provided). --- location.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 location.php diff --git a/location.php b/location.php new file mode 100644 index 0000000..00e066b --- /dev/null +++ b/location.php @@ -0,0 +1,23 @@ + "success", "message" => "Location saved successfully.")); +} else { + // If data is not present, return an error response + echo json_encode(array("status" => "error", "message" => "Location data not provided.")); +} +?>