<?php
(@include ('../dt_page/lic.php')) or die("<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>You not have a license to use this script on this domain,<br>Please contact us to purchase a license.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy;2009 - ".date("Y")." www.primadesain.com</p>");
$lic=$license;if(!$lic){echo "<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>You not have a license to use this script on this domain,<br>Please contact us to purchase a license.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy;2009 - ".date("Y")." www.primadesain.com</p>";}$svr=$_SERVER['SERVER_NAME'];$c=curl_init();curl_setopt($c,CURLOPT_URL,"http://www.primadesain.com/verifylicenses.php");curl_setopt($c,CURLOPT_TIMEOUT,30);curl_setopt($c,CURLOPT_POST,1);curl_setopt($c,CURLOPT_RETURNTRANSFER,1);$postfields='svr='.$svr.'&lic='.$lic;curl_setopt($c,CURLOPT_POSTFIELDS,$postfields);$result=curl_exec($c);if($result=="fail"){echo "<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>You not have a license to use this script on this domain,<br>Please contact us to purchase a license.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy;2009 - ".date("Y")." www.primadesain.com</p>";die();}
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();} 
?>
<?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="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
											<h4 class="modal-title"><i class="icon-user"></i>&nbsp;&nbsp;Network Tree</h4>
										</div>
										<div class="modal-body">
                                        
                                        
                                        
     
						<div class="portlet-body">
							<div class="panel-group accordion" id="accordion1">
								
                                
                            <?	
$user = $_GET['user'];
if($user){
$user_session = $user;
}else{
$user_session = $user_session;
}

	//echo "<div id='module'><h3>NETWORK TREE</h3><p>&nbsp;</p>";
	
		$lv=100;
		for($i=0;$i<$lv;$i++) {
			$j = $i + 1;
			//$db->select("username", "upline", "upline$i='$mid'");
			$ja = $db->jmlmember($user_session, "a.status=1 and b.upline$i='$user_session'"); //jml mbr aktif per level
			$jf = $db->jmlmember($user_session, "a.status=0 and blokir=0 and b.upline$i='$user_session'"); //jml mbr free per level
			$jb = $db->jmlmember($user_session, "a.blokir=1 and b.upline$i='$user_session'"); //jml mbr blokir per level
			
			if($ja > 0 or $jf > 0) {
?>    
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
										<a aria-expanded="false" class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion<?= $j; ?>" href="#collapse_<?= $j; ?>"><button class="btn btn-success btn-sm" type="button"><i class="fa fa-sitemap"></i>&nbsp;Level <?= $j; ?> Details</button></a>
										</h4>
									</div>
									<div style="height: 0px;" aria-expanded="false" id="collapse_<?= $j; ?>" class="panel-collapse collapse">
										<div class="panel-body" style="width:100%; overflow:scroll;">
										
                                            <?
					 
		//$csq=myfetch("SELECT konten FROM konten WHERE url='caragabung'");
		//echo $db->jumlahdl($mid, "1");
		$db->select("a.username, a.nama, a.status, a.blokir, a.hp, a.email, a.tglaktif, a.upline, b.sponsor, b.posisi", "member as a inner join upline as b on a.username=b.username", "b.upline$i='$user_session'");
		
		?>
                                     
                                        
                                         <!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-md-12">
					<div class="panel panel-inverse">
                       
							<table id="data-table" class="table table-bordered" cellspacing="0" width="100%">
							<thead>
							<tr>
							 <th><strong>#</strong></font></th>
        <th><strong>Username</strong></font></th>
        <th><strong>Name</strong></font></th>
        <th><strong>Sponsor</strong></font></th>
        <th><strong>Upline</strong></font></th>
        <th><strong>Position</strong></font></th>
        <th><strong>Phone</strong></font></th>
        <th><strong>Email</strong></font></th>
        
        <th><strong>Status</strong></font></th>
							</tr>
							</thead>
							<tbody>
 <?
	$ada = $db->num_rows();
	if($ada > 0) {
   		$n=1;
		while($row = $db->fetch_row()) {
			if($row[2] > 0) {
				$status = "<span class='label label-success'>Active</span>";
				$cl_status = "<span class='label label-success'>Active</span>";
			} else if($row[3] > 0) {
				$status = "<span class='label label-danger'>Blocked</span>";
				$cl_status = "<span class='label label-danger'>Blocked</span>";	
			} else {
				$status = "<span class='label label-danger'>Inactive</span>";
				$cl_status = "<span class='label label-danger'>Inactive</span>";
			}
			if($row[9] == "L2") {
				$pose = "RIGHT";	
				} else {
				$pose = "LEFT";		
				}
			if(is_odd($n) == 0) {
				$class = "even";
			} else {
				$class = "odd";
			} 		
   ?>  
   
	  <tr class="<?php echo $class; ?>"> 
        <td><?= $n; ?></td>
        <td><?= $row[0]; ?></td>
        <td><?= $row[1]; ?></td>
        <td><?= $row[8]; ?></td>
        <td><?= $row[7]; ?></td>
        <td><?= $pose; ?></td>
        <td><?= $row[4]; ?></td>
        <td><?= $row[5]; ?></td>
       
        <td align="center"><?= $status; ?></td>
      </tr>
	 <?
	 	$n++;
		 }
	} else {	 
	 ?> 
	 <tr>
            <td colspan="6" align="center"><strong>No Data.</strong></td>
    </tr>
	<?
	}
	?>        
							</tbody>
							</table>
						</div>
					</div>
					<!-- END EXAMPLE TABLE PORTLET-->
				</div>
			</div>
			<!-- END PAGE CONTENT -->                       
										</div>
									</div>
								</div>
								
						
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                   
	  <?
			  }
			  }
	?>
	 
	
</div>
										<div class="modal-footer">
									<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i>&nbsp;Close</button>
										</div>
                                        <?php } ?>