<?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/team.png" alt="Network" class="header-icon" width="30">
                    Network
                </h1>
            </div>
        </div>
<?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-4">
                <div class="input-group p-b-10">
                    <input id="ref_url" class="form-control" name="ref_url" type="text" value="https://<?php echo $domain; ?>/?<?php echo $reffa; ?>=<?php echo $user_session; ?>">
                    <span class="input-group-btn">
                        <button id="copy-ref-url" class="btn btn-primary" type="button">Copy</button>
                    </span>
                </div>

            </div>
           
        </div>

               
<div class="row">
            	<div class="col-md-12">
                	
                    
                     
                   <div class="panel panel-inverse">
                        <div class="panel-heading bg-grey">
                            <h4 class="text-white">Refferals</h4>
                        </div>
                        
                        <div class="panel-body">
                        
                        
                        
                        
                        
                                                            
                                    <table id="data-table" class="table table-bordered" cellspacing="0" width="100%">
                                  <thead>
                <tr>
                   <th align="center"><?php echo $LANG["dtsp_joindate"]?></th>
                        <th align="center">User ID</th> 
                        <th align="center"><?php echo $LANG["name"]?></th> 
                        <th align="center">Phone</th> 
                        <th align="center"><?php echo $LANG["email"]?></th> 
                        <th align="center">Status</th> 
                </tr>
              </thead>
              <tbody>
       <?

	$db->select("id, username, nama, foto, kota, propinsi, email, hp, status, sponsor, tgl", "member", "sponsor='$user_session'", "id desc");
	$ada = $db->num_rows();
		while($row=$db->fetch_row()) {
			
		
			if($row[8] > 0) {
				$st = "<span class='btn btn-success btn-xs'>Active</span>";
			} else {
				$st = "<span class='btn btn-danger btn-xs'>Inactive</span>";
			}		
	
	$userku=$row[1];
		$namaku = "SELECT * FROM member WHERE username='$userku'"; 
	 
        $resultku = mysql_query($namaku);


$rownamaku = mysql_fetch_array($resultku);
$namaku = $rownamaku['nama'];	
	
		$userspon=$row[9];
		$namaspon = "SELECT * FROM member WHERE username='$userspon'"; 
	 
        $resultnamaspon = mysql_query($namaspon);


$rownamaspon = mysql_fetch_array($resultnamaspon);
$namaspone = $rownamaspon['nama'];	
?>				
				
<tr>
                            <td align="center"><?php echo formatgl($row[10]); ?></td>
                            <td align="center"><?php echo $row[1]; ?></td>
                            <td align="center"><?php echo $row[2]; ?></td>
                            <td align="center"><?php echo $row[7]; ?></td>
                            <td align="center"><?php echo $row[6]; ?></td>
                            <td align="center"><?php echo $st; ?></td>
                        </tr>
                                                                    
             <?
		}
	?>
              </tbody>
            </table>
                                </div>
                    </div>
                </div>
			</div>
			<!-- END PAGE CONTENT -->                       
                        
                    <?php } ?>