<?php



$servername = "localhost";
$username = "venmobdc_OnlineClassuser";
$passworde = "EuN&(VkTztyS";
$database = "venmobdc_OnlineClass";

// Create connection
$conn = new mysqli($servername, $username, $passworde, $database);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

header('Content-Type: application/json; charset=utf-8');
mysqli_set_charset($conn, "utf8");

$Device_Active_Check = $_GET['Device_Active_Check'];
$id = $_GET['id'];

// Validate inputs (you might want to add more validation)
if (isset($Device_Active_Check, $id)) {
    $Device_Active_Check = $conn->real_escape_string($Device_Active_Check);
    $id = $conn->real_escape_string($id);

    $sql = "UPDATE User_Details SET Device_Active_Check='$Device_Active_Check' WHERE id='$id'";
    $result = mysqli_query($conn, $sql);

    if ($result) {
        echo json_encode(array("status" => "success", "message" => "Record updated successfully"));
    } else {
        echo json_encode(array("status" => "error", "message" => "Error updating record: " . mysqli_error($conn)));
    }
} else {
    echo json_encode(array("status" => "error", "message" => "Missing parameters"));
}

$conn->close();
?>