<?php
require_once('session.php');
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') {
	header("HTTP/1.1 403 Forbidden");
	echo "Access forbidden. Use HTTPS.";
	exit();
}
$id = $_GET['cuid'];
$sql_1 = mysqli_query($conn,"SELECT * FROM `tb_transaksi` WHERE cuid = '$id'") or die(mysqli_error());
$s1 = mysqli_fetch_array($sql_1);
$usersID = $s1['userID'];
$amounts = $s1['total'];
$nominal = $amounts;

if($s1['status'] == 0){
	$cek_usernya = mysqli_query($conn, "SELECT * FROM tb_user WHERE cuid = '$usersID'");
	$data_usernya = mysqli_fetch_array($cek_usernya);
	$extplayer = $data_usernya['extplayer'];
    $kingisback->depositBalance($extplayer, $nominal);
	$update = mysqli_query($conn,"UPDATE `tb_transaksi` SET `status` = 2 WHERE `cuid` = '$id'") or die(mysqli_error($conn));
}
header('location:../withdraw/');
?>