<?php
header('Content-Type: application/json');
require_once '../config/db.php';

$wallet = $_GET['wallet'];

if ($wallet) {
    mysqli_begin_transaction($conn);
    try {
        mysqli_query($conn, "DELETE FROM users WHERE wallet = '$wallet'");
        mysqli_query($conn, "DELETE FROM deposits WHERE wallet = '$wallet'");
        mysqli_query($conn, "DELETE FROM withdrawals WHERE wallet = '$wallet'");
        mysqli_commit($conn);
        echo json_encode(["success" => true]);
    } catch (Exception $e) {
        mysqli_rollback($conn);
        echo json_encode(["success" => false]);
    }
}
?>