<?php
include('confing.php');

if(isset($_POST['user_id']) && isset($_POST['user_latitude']) && isset($_POST['user_longitude']) && isset($_POST['status'])) {
    $user_id = $_POST['user_id'];
    $latitude = $_POST['user_latitude'];
    $longitude = $_POST['user_longitude'];
        $status = $_POST['status'];

    
    $query = "INSERT INTO booking (user_id, user_latitude, user_longitude,status) VALUES ('$user_id', '$latitude', '$longitude', '$status')";
    
    if(mysqli_query($conn, $query)){
        echo json_encode(["status" => "success", "message" => "Location inserted successfully"]);
    } else {
        echo json_encode(["status" => "error", "message" => "Failed to insert location"]);
    }
} else {
    echo json_encode(["status" => "error", "message" => "Missing parameters"]);
}

?>
