<?php
include '../db/koneksi.php';
session_start();
header('Content-Type: application/json');

$extplayer = $_SESSION['extplayer'] ?? '';
if (empty($extplayer)) {
    echo json_encode(['success' => false, 'message' => 'Session tidak valid']);
    exit;
}

$q = mysqli_query($koneksi, "
    SELECT status, created_at, bank_asal, bank_tujuan, jumlah 
    FROM tb_deposit 
    WHERE extplayer = '$extplayer'
    ORDER BY id DESC 
    LIMIT 7
");

$data = [];
while ($row = mysqli_fetch_assoc($q)) {
    $data[] = $row;
}

echo json_encode(['success' => true, 'data' => $data]);
exit;
?>
