<?php
if(isset($_GET['id'])){
$id = $_GET['id'];

$q = mysqli_query($koneksi,"SELECT * FROM tb_scater WHERE id='$id'");
$d = mysqli_fetch_assoc($q);

if(!$d) exit('Data tidak ditemukan');

$id_user = $d['id_user'];
$bonus   = $d['total_bonus'];

// Tambah saldo user
mysqli_query($koneksi,"
    UPDATE tb_saldo 
    SET active = active + $bonus 
    WHERE id_user = '$id_user'
");

// Update status claim
mysqli_query($koneksi,"
    UPDATE tb_scater 
    SET status='approved' 
    WHERE id='$id'
");
?>
<script>
alert('Claim Scatter berhasil di approve');
window.location='?page=permintaan_claim_scater';
</script>
<?php } ?>