<?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();} 
?>
 <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Bonus
      </h1>
      <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="breadcrumb-item active">Bonus</li>
      </ol>
    </section>


    <section class="content">

<?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="box box-solid bg-dark">
            <div class="box-header with-border">
              <h3 class="box-title">Bonus [Total Bonus : <?php
		$ttlbonusee = total_komisi_memberx($user_session);
if($ttlbonusee>0) { echo rupiah($ttlbonusee); }else{ echo rupiah(0); }
?>]
</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
				<div class="table-responsive">
				  <table id="example" class="table table-bordered table-hover display nowrap margin-top-10 w-p100">            
                  
                  
                                                <thead class="bg-primary-600">
										<tr>
										  <th>Date</th>
                                    <th>From</th>
                                    <th>Type</th>
                                    <th>Amount</th>
                                    <th>#</th>
										</tr>
									</thead>
									<tbody>
										<?
										

	
$db->select("id, username, bayar, tglbayar, status, total, jenis, dari, kode, gett", "komisi", "jenis<>'komshare' and jenis<>'komtrade' and username='$user_session'", "tglbayar desc");
	
		while($row=$db->fetch_row()) {
             if($row[6] == "komsponsor"){
			$jenise = "Refferal Bonus";
			}else if($row[6] == "matchingpro1"){
			$jenise = "Matching Profit Level 1";
			}else if($row[6] == "matchingpro2"){
			$jenise = "Matching Profit Level 2";
			}else if($row[6] == "matchingpro3"){
			$jenise = "Matching Profit Level 3";
			}else if($row[6] == "matchingpro4"){
			$jenise = "Matching Profit Level 4";
			}else if($row[6] == "matchingpro5"){
			$jenise = "Matching Profit Level 5";
			
			}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 if($row[6] == "komsponsor5"){
			$jenise = "Refferal Bonus Level 5";
			
			}else if($row[6] == "komsponsor6"){
			$jenise = "Refferal Bonus Level 6";
			
			}else if($row[6] == "komsponsor7"){
			$jenise = "Refferal Bonus Level 7";
			
			}else if($row[6] == "komsponsor8"){
			$jenise = "Refferal Bonus Level 8";
			
			}else if($row[6] == "komsponsor9"){
			$jenise = "Refferal Bonus Level 9";
			
			}else if($row[6] == "komsponsor10"){
			$jenise = "Refferal Bonus Level 10";
			
			}else if($row[6] == "komsponsor11"){
			$jenise = "Refferal Bonus Level 11";
			
			}else if($row[6] == "komsponsor12"){
			$jenise = "Refferal Bonus Level 12";
			
			}else if($row[6] == "komsponsor13"){
			$jenise = "Refferal Bonus Level 13";
			
			}else if($row[6] == "komsponsor14"){
			$jenise = "Refferal Bonus Level 14";
			
			}else if($row[6] == "komsponsor15"){
			$jenise = "Refferal Bonus Level 15";
			
			}else if($row[6] == "kompasangan"){
			$jenise = "Pairing Bonus";
			
			}else{
			
			}
	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-primary'>To Wallet</span>";
			} 	else {
				$sts = "";
			}
		
		
		$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'];	

?>				             
                     <tr> 
                            <td><?php echo formatgl($row[3]); ?></td>
                            <td><?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>

 </div>	                
<?php } ?>
</section>