<?php
include '../include/pay_connection.php'; // Adjust the path if necessary

if (isset($_GET['uid']) && isset($_GET['status'])) {
    $userId = $_GET['uid'];
    $status = $_GET['status'];

   
    // echo "Received user ID: " . htmlspecialchars($userId) . " with status: " . htmlspecialchars($status) . "<br>";

    $sql = "UPDATE `api_key` SET `status` = ? WHERE `user_id` = ?";
    if ($stmt = $link->prepare($sql)) {
        $stmt->bind_param("is", $status, $userId);

        if ($stmt->execute()) {
            echo "Status updated successfully.<br>";
        } else {
            echo "Execute failed: " . $stmt->error . "<br>";
        }

        $stmt->close();
    } else {
        echo "Prepare failed: " . $link->error . "<br>";
    }
} else {
    echo "Required parameters not set.<br>";
}

$link->close();
?>
