<?php
session_start();
header('Content-Type: application/json');
if (!isset($_SESSION['admin_id']) && $_SESSION['role'] != 'admin') {
    echo json_encode(['success' => false, 'message' => 'Unauthorized']);
    exit();
}
include '../../../include/config.php';

$data = json_decode(file_get_contents('php://input'), true);
$id = $data['id'] ?? 0;
$status = $data['status'] ?? '';

if ($id && $status) {
    $conn->query("UPDATE hps_subscriptions SET status = '$status' WHERE id = '$id'");
    echo json_encode(['success' => true]);
} else {
    echo json_encode(['success' => false]);
}
?>