<?php
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
?>
 <div class="row">
            <div class="col-md-12">
                <h1 class="page-header">
                    <img src="../themes/img/ico.png" alt="bonus" class="header-icon" width="30">
                    Bonus
                </h1>
            </div>
        </div>
 

 <?php

$totkom = total_komisi_memberx($user_session);
    $twdne = total_wdbonus_member($user_session);
	$totkome=$totkom;
	$tarik = $totkome - $twdne;

if($tarik > 0){
$tarikane = rupiah($tarik);
}else{
$tarikane = "0";
}
?>   
<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["status0"]."</div>";
}else{
?>

<div class="row">
            	<div class="col-md-12">
                	
                    
                   <div class="panel panel-inverse">
                        <div class="panel-heading bg-grey">
                            <h4 class="text-white">Bonus</h4>
                        </div>
                        
                        <div class="panel-body">
                        
                        
                        
                        
                        
                                                          
                                    <table id="data-table" class="table table-bordered" cellspacing="0" width="100%">
                    
                    
              <thead>
                <tr>
              <th><?php echo $LANG["mbph_dt"]?></th>
                                    <th><?php echo $LANG["mbph_to"]?></th>
                                    <th><?php echo $LANG["mbph_from"]?></th>
                                    <th><?php echo $LANG["mbph_type"]?></th>
                                    <th><?php echo $LANG["amount"]?></th>
                                    <th>#</th>
                </tr>
              </thead>
              <tbody>
	<?
$db->select("id, username, bayar, tglbayar, status, total, jenis, dari, kode, gett", "komisi", "jenis not like '%komshare%' and username='$user_session'", "tglbayar desc");
	
		while($row=$db->fetch_row()) {
            if($row[6] == "komsponsor"){
			$jenise = "Refferal Bonus Level 1";
			}else if($row[6] == "komsponsor2"){
			$jenise = "Refferal Bonus Level 2";
			}else if($row[6] == "komsponsor3"){
			$jenise = "Refferal Bonus Level 3";
			}else if($row[6] == "komsponsor4"){
			$jenise = "Refferal Bonus Level 4";
			}else{
			$jenise = "".$row[6]." Bonus";
			
			}
	if($row[2] >= $minimalbonus){	
		$getbonus = "<a class='various5xx' data-fancybox-type='iframe' href='page.php?go=requestbonus&amount=$row[2]&kode=$row[8]'><button class='mmm_blue' style='padding:0px 7px;font-size:11px;' onMouseover=\"ddrivetip('Get This Bonus')\" onMouseout='hideddrivetip()'>Get Bonus</button></a>";
		}else{
		$getbonus = "--";
		}
		
		if($row[9] == 1) {
				$sts = "<span class='label label-success'>Open</span>";
				$style = "";
				$getbonus = "---";
			
			} else if($row[9] == 2) {
				$sts = "<span class='label label-danger'>Lock</span>";
				$style = "";
				$btrans = "";
				$getbonus = $getbonus;
			} 	else {
				$sts = "";
				$style = "<font>";
			}
		
		
		$user1=$row[1];
		$namaspon1 = "SELECT * FROM member WHERE username='$user1'"; 
        $resultnamaspon1 = mysql_query($namaspon1);
$rownamaspon1 = mysql_fetch_array($resultnamaspon1);
$namaspone1 = $rownamaspon1['nama'];	
		
		$user=$row[7];
		$namaspon = "SELECT * FROM member WHERE username='$user'"; 
        $resultnamaspon = mysql_query($namaspon);
$rownamaspon = mysql_fetch_array($resultnamaspon);
$namaspone = $rownamaspon['nama'];	
$tglaktiv = $rownamaspon['tglaktif'];	
$totnya = total_komisi_member($user_session);

?>				             
                     <tr> 
                            <td><?php echo formatgl($row[3]); ?></td>
                            <td><?php echo $namaspone1; ?> (<?php echo $row[1]; ?>)</td>
                            <td><?php echo $namaspone; ?> (<?php echo $row[7]; ?>)</td>
                            <td><?php echo $jenise; ?></td>
                            <td><?php echo rupiah($row[2]); ?></td>
                            <td><?php echo $sts; ?></td>
                        </tr>
                                                                    
        
	<?
		}
	?>
              </tbody>
            </table>
                        </div>
                    </div>
                </div>
			</div>
			<!-- END PAGE CONTENT -->                       



                     
<?php } ?>