PATH: /home/hwyuvbry/sahabat.waroenkhoki123.web.id/mobile/function
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 cek_login.php
↓
X
📄 daftar_akun.php
↓
X
📄 deposit.php
↓
X
📄 error_log
↓
X
📄 functions.php
↓
X
📄 getBalances.php
↓
X
📄 getBalances.php#
↓
X
📄 index.php
↓
X
📄 kyc.php
↓
X
📄 logout.php
↓
X
📄 profil.php
↓
X
📄 withdraw.php
↓
X
📄 withdraw.php#
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: withdraw.php
<?php session_start(); error_reporting(0); include '../../function/connect.php'; include '../../main/API/functions.php'; $id_login = $_SESSION['id']; // contoh: juragan76 $extplayer = $_SESSION['extplayer']; // contoh: abperi00lpd7 if (isset($_POST['submit'])) { $jumlah = floatval($_POST['jumlah']); $keterangan = "Withdraw"; $tanggal = date('Y-m-d H:i:s'); // 🔹 Ambil minimal withdraw $query99 = mysqli_query($koneksi, "SELECT * FROM tb_web"); $cek_wd = mysqli_fetch_array($query99); $wd = $cek_wd['min_wd']; // 🔹 Ambil data rekening user (PAKAI id_login ✅) $queryBank = mysqli_query($koneksi, "SELECT * FROM tb_bank WHERE id_user = '$id_login'"); $dataBank = mysqli_fetch_assoc($queryBank); $nama_bank = $dataBank['nama_bank'] ?? ''; $no_rek = $dataBank['nomor_rekening'] ?? ''; $nama_rek = $dataBank['nama_pemilik'] ?? ''; // ❌ Jika rekening belum ada if (empty($no_rek)) { ?> <script> alert('Data rekening belum diisi, silahkan isi terlebih dahulu'); window.location='?page=profile'; </script> <?php exit; } // 🔹 Format untuk tampil di admin $dari_bank = $nama_bank . ' - ' . $no_rek . ' - ' . $nama_rek; // 🔹 Cek transaksi withdraw pending $cek = mysqli_query($koneksi, "SELECT * FROM tb_transaksi WHERE id_user = '$extplayer' AND transaksi = 'Withdraw' AND status IN ('Pending','Belum Bayar')"); if (mysqli_num_rows($cek) > 0) { ?> <script> alert('Anda masih memiliki proses withdraw yang belum selesai'); window.location='?page=withdraw'; </script> <?php exit; } // 🔹 Ambil saldo dari API $response1 = $SGX->userbalance($extplayer); $saldo_api = $response1['user']['balance']; // ❌ Saldo tidak cukup if ($saldo_api < $jumlah) { ?> <script> alert('Saldo Anda tidak mencukupi'); window.location='?page=withdraw'; </script> <?php exit; } // ❌ Minimal withdraw if ($jumlah < $wd) { ?> <script> alert('Withdraw minimal <?php echo $wd ?>'); window.location='?page=withdraw'; </script> <?php exit; } // 🔹 Cek turnover bonus $queryTurn = mysqli_query($koneksi, "SELECT * FROM tb_turnover WHERE id_user = '$extplayer'"); if (mysqli_num_rows($queryTurn) == 1) { $cek_turn = mysqli_fetch_array($queryTurn); $id_bonus = $cek_turn['id_bonus']; $queryBonus = mysqli_query($koneksi, "SELECT * FROM tb_bonus WHERE id = '$id_bonus'"); $cek_bonus = mysqli_fetch_array($queryBonus); $bonus = $cek_bonus['bonus']; $turn = $cek_bonus['turnover']; $target = $bonus * $turn; if ($saldo_api < $target) { ?> <script> alert('Anda belum memenuhi syarat turnover bonus'); window.location='?page=withdraw'; </script> <?php exit; } } // 🔥 PROSES WITHDRAW API $responseWD = $SGX->withdraw($extplayer, $jumlah); if ($responseWD['status'] == 1) { // 🔹 Simpan ke transaksi (SUDAH ADA DATA REKENING) $query = mysqli_query($koneksi, "INSERT INTO tb_transaksi( id, gambar, tanggal, transaksi, total, dari_bank, metode, bonus, keterangan, status, id_user ) VALUES ( NULL, '', '$tanggal', 'Withdraw', '$jumlah', '$dari_bank', '', '', '$keterangan', 'Pending', '$extplayer' )"); // 🔹 Update saldo DB mysqli_query($koneksi, "UPDATE tb_saldo SET active = active - '$jumlah', pending = pending + '$jumlah' WHERE id_user = '$extplayer'"); ?> <script> alert('Withdraw berhasil, silahkan tunggu konfirmasi admin'); window.location='?page=withdraw'; </script> <?php } else { ?> <script> alert('Withdraw gagal, coba lagi'); window.location='?page=withdraw'; </script> <?php } } ?>
SIMPAN PERUBAHAN