<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    include '../db.php';



    if (isset($_POST['userId'])) {

        $userId = mysqli_real_escape_string($con, $_POST['userId']);



        // Query to fetch current status

        $query = "SELECT uStatus FROM users WHERE uid = '$userId'";

        $result = mysqli_query($con, $query);



        if ($result) {

            $row = mysqli_fetch_assoc($result);

            echo json_encode(['uStatus' => $row['uStatus']]);

        } else {

            echo json_encode(['error' => 'Error fetching status']);

        }



        mysqli_close($con);

    }

}

?>