<?php
//error_reporting(0);
include('session.php');
$today = date('Y-m-d');

$getDeposit =  mysqli_query($conn,"SELECT * FROM `tb_transaksi` WHERE date LIKE '$today%' AND jenis = 1 AND status = 0 ORDER BY cuid DESC LIMIT 1") or die(mysqli_error());
$gdd = mysqli_num_rows($getDeposit);
if($gdd > 0){
	$gd = mysqli_fetch_array($getDeposit);
	$usersID = $gd['userID'];
	$getUser = mysqli_query($conn,"SELECT * FROM `tb_user` WHERE cuid = '$usersID'") or die(mysqli_error());
	$gu = mysqli_fetch_array($getUser);
	echo '
		<div class="alert alert-info alert-dismissible text-dark" role="alert">
            Deposit Baru dari '.$gu['user'].' Sebesar Rp. '.number_format($gd['total']).'<br>
            <a href="'.$urlweb.'/request_depo/">Klik Disini</a> Untuk Menerima
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>                      
        </div>
	';
}

$getWithdraw =  mysqli_query($conn,"SELECT * FROM `tb_transaksi` WHERE date LIKE '$today%' AND jenis = 2 AND status = 0 ORDER BY cuid DESC LIMIT 1") or die(mysqli_error());
$gww = mysqli_num_rows($getWithdraw);
if($gww > 0){
	$gw = mysqli_fetch_array($getWithdraw);
	$usersID = $gw['userID'];
	$getUser = mysqli_query($conn,"SELECT * FROM `tb_user` WHERE cuid = '$usersID'") or die(mysqli_error());
	$gu = mysqli_fetch_array($getUser);
	echo '
		<div class="alert alert-danger alert-dismissible text-dark" role="alert">
            Permintaan Withdraw dari '.$gu['user'].' Sebesar Rp. '.number_format($gw['total']).'<br>
            <a href="'.$urlweb.'/request_wd/">Klik Disini</a> Untuk Menerima
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>                      
        </div>
	';
}
?>
<script type="text/javascript">
    function play_sound() {
        var audioElement = document.createElement('audio');
        audioElement.setAttribute('src', '../notif.mp3');
        audioElement.setAttribute('autoplay', 'autoplay');
        audioElement.load();
        audioElement.play();
    }
</script>