<?php
session_start();
include "../../connect/db.php";
if (!isset($_SESSION['man'])) { die("Access Denied"); }
if (!isset($_POST['id'])) { die("Invalid request."); }

$id = intval($_POST['id']);
$mysqli->query("UPDATE virtualcard SET status = 'cancelled' WHERE id = $id AND status = 'pending'");
echo $mysqli->affected_rows > 0 ? "success" : "not found or already processed";
