<?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>
        Dashboard
        <small>Control panel</small>
      </h1>
      <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="breadcrumb-item active">Dashboard</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <? 
if($db->dataku("free", $user_session) == 1 && $freetradings == 1){ ?>
	<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>You are currently in demo (Free) mode, <a href='index.php?toreal'><strong>Click here</strong></a> to enter Real Mode</div>
    <?php } ?>
	
			
		
		  <div class="row">
            <div class="col-md-6" style="margin-bottom:15px;">
                <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-<?php echo $buttone; ?>" type="button" style="height:46px;">Copy Reff URL</button>
                    </span>
                </div>
                </div>

            </div>
		
        
        
        
            
              <?php if($investment == 1 && $ada_assx) {?>
         <div class="row">	
     
            
        <?php
						$seldepo = "SELECT * FROM deposit WHERE username='$user_session' and status=1 ORDER by id desc"; 
                        $resdepo = mysql_query($seldepo);
                        $ada_depoe = mysql_num_rows($resdepo);
                        while($rowsdpo = mysql_fetch_array($resdepo)){
                        $planame = $rowsdpo['planame'];	
                        $jml = $rowsdpo['jml'];	
                        $expdpow = $rowsdpo['tglend'];	
                        $kodee = $rowsdpo['kode'];
                        $profitee = $rowsdpo['profit'];
                        $scnee = $rowsdpo['sc'];
                        $kontrakee = $rowsdpo['kontrak'];
                        $statusv = $rowsdpo['status'];
						if($ada_depoe>0){
							
						if($statusv == 1){	
                        $wrnane="nbg-green";	
						}else{
                        $wrnane="nbg-red";	
						}
						 if($scnee == "day"){
		   $pdd = "Daily";
		   $pddx = "Day";
	   }else if($scnee == "week"){
		   $pdd = "Weekly";
		   $pddx = "Week";
	   }else{
		   $pdd = "Monthly";
		   $pddx = "Month";
	   }	
	   
	   
  $ttlprofite=($profitee/100)*$jml;
  $ttlroine=$kontrakee*$ttlprofite;
	   
							
						?>   
              
      	<div class="col-12 col-lg-6">
				 <?php if($db->config("styletheme") == 1){ ?>
				<div class="box box-body pull-up bg-hexagons-dark">
                  <?php } else { ?>
				<div class="box box-body pull-up bg-hexagons-white">
                  <?php } ?>
				  <div class="media align-items-center p-0">
					<div class="text-center">
					  <a href="#"><i class="mdi mdi-checkbox-marked-circle-outline" title="Package" style="font-size:36px; color:<?php echo $themewarna; ?>; margin-bottom:18px;"></i></a>
					</div>
					<div>
					  <h2 class="no-margin" style="font-size:16px; line-height:170%;"><?php 
	echo "<strong>".$planame."</strong>";
	$amountdepone=" <font style='font-size:14px;'>(".rupiah($jml).")</font>";
	
?><?php echo $amountdepone; ?><br />
<font style="font-size:12px; color:#0C9;">Profit <?php echo $profitee; ?>% <?php echo rupiah($ttlprofite); ?> <?php echo $pdd; ?><br />Contract/ROI <?php echo $kontrakee; ?> <?php echo $pddx; ?> (<?php echo rupiah($ttlroine); ?>)</font>
</h2>
					</div>
				  </div>
				  <div class="flexbox align-items-center mt-25">
					<div>
					  <p class="no-margin">Exp : <?php echo formatglxxy($expdpow); ?><span class="text-gray"></span> <span class="text-info"></span></p>
					</div>
					<div class="text-right">
					  <p class="no-margin"><span class="text-success"><a href="index.php?go=deposit&page=details&co=<?php echo $kodee; ?>"><span class="text-<?php echo $buttone; ?>">Details</span></a></span></p>
					</div>
				  </div>
				</div>
			</div>      
            
            <?php } ?>
            <?php } ?>
            
            
			</div> 
            <?php } ?>
        
        
        
        <div class="row">			
		
          <div class="col-lg-3 col-md-6">
				<div class="box pull-up">
              <?php if($db->config("styletheme") == 1){ ?>
				  <div class="box-body pull-up bg-hexagons-dark">
                  <?php } else { ?>
				  <div class="box-body pull-up bg-hexagons-white">
                  <?php } ?>
                  
					  <div class="media align-items-center p-0">
						<div class="text-center">
						  <a href="#"><i class="mdi mdi-account-multiple" title="Refferal" style="font-size:36px; color:<?php echo $themewarna; ?>; margin-bottom:18px;"></i></a>
						</div>
						<div>
						  <h3 class="no-margin text-bold">Refferal</h3><span>totals refferal</span>
						</div>
					  </div>
					  <div class="flexbox align-items-center mt-5">
						<div>
						  <p class="no-margin font-weight-600" style="font-size:18px;"><span class="text-yellow"><?php $ceksponku="SELECT * FROM member where sponsor='".$user_session."' and act=1";
$queryspone=mysql_query($ceksponku);
$totalespone=mysql_num_rows($queryspone); if($totalespone>0){ echo $totalespone.""; } else { echo "0";} ?>  members</span> <span class="text-info"></span></p>
						</div>
						<div class="text-right">
						  <p class="no-margin font-weight-600"><a href="index.php?go=datasp"><span class="text-<?php echo $buttone; ?>">Details</span></a></p>
						</div>
					  </div>
				</div>
				<div class="box-footer p-0 no-border">
					<div class="chart"><canvas id="chartjs3" class="h-80"></canvas></div>
				</div>
			 </div>
		  </div>
        
			<div class="col-lg-3 col-md-6">
				<div class="box pull-up">
              <?php if($db->config("styletheme") == 1){ ?>
				  <div class="box-body pull-up bg-hexagons-dark">
                  <?php } else { ?>
				  <div class="box-body pull-up bg-hexagons-white">
                  <?php } ?>
					  <div class="media align-items-center p-0">
						<div class="text-center">
						<i class="mdi mdi-cash-100" title="Omset" style="font-size:36px; color:<?php echo $themewarna; ?>; margin-bottom:18px;"></i>
						</div>
						<div>
						  <h3 class="no-margin text-bold">Bonus</h3><span>Total Bonus</span>
						</div>
					  </div>
					  <div class="flexbox align-items-center mt-5">
						<div>
						  <p class="no-margin font-weight-600" style="font-size:18px;"><span class="text-yellow">
                       <?  $saldobwalete = total_komisi_memberx($user_session);
			 if($saldobwalete > 0){ echo rupiah($saldobwalete); }else{ echo rupiah(0);} ?>
                          </span><span class="text-info"></span></p>
						</div>
						<div class="text-right">
						<p class="no-margin font-weight-600"><a href="index.php?go=bonus"><span class="text-<?php echo $buttone; ?>">Details</span></a></p>
						</div>
					  </div>
				</div>
				<div class="box-footer p-0 no-border">
					<div class="chart"><canvas id="chartjs2" class="h-80"></canvas></div>
				</div>
			 </div>
		  </div>
            <div class="col-lg-3 col-md-6">
				<div class="box pull-up">
              <?php if($db->config("styletheme") == 1){ ?>
				  <div class="box-body pull-up bg-hexagons-dark">
                  <?php } else { ?>
				  <div class="box-body pull-up bg-hexagons-white">
                  <?php } ?>
					  <div class="media align-items-center p-0">
						<div class="text-center">
                        
						<i class="mdi mdi-chart-areaspline" title="Profits" style="font-size:36px; color:<?php echo $themewarna; ?>; margin-bottom:18px;"></i>
                          
						</div>
						<div>
						  <h3 class="no-margin text-bold">Profits</h3><span>Total Profit</span>
						</div>
					  </div>
					  <div class="flexbox align-items-center mt-5">
						<div>
						  <p class="no-margin font-weight-600" style="font-size:18px;"><span class="text-yellow"><?php	
$ttlproff = total_profit_member($user_session);
						   if ($ttlproff > 0){ echo rupiah($ttlproff); }else { echo rupiah(0); }
						   ?></span><span class="text-info"></span></p>
						</div>
						<div class="text-right">
						  <p class="no-margin font-weight-600"><a href="index.php?go=profits"><span class="text-<?php echo $buttone; ?>">Details</span></a></p>
						</div>
					  </div>
				</div>
				<div class="box-footer p-0 no-border">
					<div class="chart"><canvas id="chartjs4" class="h-80"></canvas></div>
				</div>
			 </div>
		  </div>
         
			 <div class="col-lg-3 col-md-6">
				<div class="box pull-up">
              <?php if($db->config("styletheme") == 1){ ?>
				  <div class="box-body pull-up bg-hexagons-dark">
                  <?php } else { ?>
				  <div class="box-body pull-up bg-hexagons-white">
                  <?php } ?>
					  <div class="media align-items-center p-0">
						<div class="text-center">
						<i class="mdi mdi-wallet" title="Wallet" style="font-size:36px; color:<?php echo $themewarna; ?>; margin-bottom:18px;"></i>
						</div>
						<div>
						  <h3 class="no-margin text-bold"><?php echo $currencye; ?> Wallet</h3><span>Your Balance</span>
						</div>
					  </div>
					  <div class="flexbox align-items-center mt-5">
						<div>
						  <p class="no-margin font-weight-600" style="font-size:18px;"><span class="text-yellow"><?  $saldocwalete = $db->mycwalet($user_session);
			 $pendingcwalete = $db->mycwaletpending($user_session);
			 $totalcwalete = $saldocwalete-$pendingcwalete; 
			 if($totalcwalete > 0){ echo rupiah($totalcwalete); }else{ echo rupiah(0);} ?></span><span class="text-<?php echo $buttone; ?>"></span></p>
						</div>
						<div class="text-right">
						  <p class="no-margin font-weight-600"><a href="index.php?go=walletcash"><span class="text-<?php echo $buttone; ?>">Details</span></a></p>
						</div>
					  </div>
				</div>
				<div class="box-footer p-0 no-border">
					<div class="chart"><canvas id="chartjs1" class="h-80"></canvas></div>
				</div>
			 </div>
		  </div>
			
      
		  </div>
        
        
        
        
     
        
        
        
         <?php
				$db->select("id, title, maintext", "content", "published=1 and catid=5");
				if ($db->num_rows() > 0) {
$title = $db->result(0, "title");
$data = $db->result(0, "maintext");
$data = preg_replace("/{NAMAMEMBER}/", $db->dataku("nama", $user_session), $data);
$data = preg_replace("/{USERNAME}/", $user_session, $data);
$data = preg_replace("/{REFFA}/", $reffa, $data);
$data = preg_replace("/{BISNISNAME}/", $bisnisname, $data);
$data = preg_replace("/{DOMAIN}/", $domain, $data);

				?> 
          <div class="row">
        
       <div class="col-lg-12 col-12">
			  
              
              
              <div class="box">
			
            	<div class="box-header with-border">
				  <h4 class="box-title"><?php echo $title;?></h4>
				</div>
				<div class="box-body p-15">
                <?php echo $data;?>
                
                  </div>
				</div>
				</div>
				</div>
                
                <?php } ?> 
        
        
       <div class="row">
        
       <div class="col-lg-6 col-12">
			  
              
              
              <div class="box">
			
            	<div class="box-header with-border">
				  <h4 class="box-title">Latest News</h4>
				</div>
				<div class="box-body p-0">
                
                <div class="media-list media-list-hover media-list-divided">
	<?php

$db->select("id_berita, id_user, judul, isi_berita, gambar, tanggal, counter, published", "berita", "published=1", "id_berita desc LIMIT 5");

	while($row = $db->fetch_row()) {
	$judul = $row[2];
	$tgl = formatgl($row[5]);
	$idne = anti_injection($row[0]);
   
	
	?>  
                    
                    <a class="media media-single" href="?go=news&page=detail&nid=<?php echo $idne; ?>">
					  <span class="avatar avatar-sm bg-yellow"><i class="fa fa-newspaper-o"></i></span>
					  <div class="media-body">
						<p><?php echo $judul; ?></p>
						<time datetime="2017-07-14 20:00"><?php echo $tgl; ?></time>
					  </div>
					</a>
                    
                                            
        
	<?
		}
	?>
            
                    
				  </div>
				</div>
				<!-- /.box-body -->
			  </div> </div>
              
    
		 
         
          <div class="col-lg-6 col-12">
			  
              
              
              
           <div class="box">
			
            	<div class="box-header with-border">
				  <h4 class="box-title">Latest Notification</h4>
				</div>
				<div class="box-body p-0">
                
                <div class="media-list media-list-hover media-list-divided">
	<?php
            $querymnmg = "SELECT * FROM notifikasi WHERE username ='$user_session' order by tgl desc limit 4"; 
            $resultmnmg = mysql_query($querymnmg) or die(mysql_error());
            while($rowmnmg = mysql_fetch_array($resultmnmg)){
			$kd88 = $rowmnmg['kode'];
			$judulnotif = $rowmnmg['judul'];
			$badgene = $rowmnmg['badge'];
			$fawesom = $rowmnmg['jn'];
			$tglen = formatgl($rowmnmg['tgl']);
			$srttglmmg = strtotime($rowmnmg['tgl']);
            $srttglendg = strtotime($clientdate);
			$jlneeg = floor(abs($srttglendg - $srttglmmg));
			
			if($jlneeg < 60){
			$jlnxg = "just now";
			
			}else if($jlneeg > 60 && $jlneeg < 3600){
			$jlnxg = floor(abs($jlneeg/60))." minutes";
			
			}else if($jlneeg > 3600 && $jlneeg < 86400){
			$jlnxg = floor(abs($jlneeg/3600))." hours";
			
			}else if($jlneeg > 86400 && $jlneeg < 604800){
			$jlnxg = floor(abs($jlneeg/86400))." days";
			
			}else if($jlneeg > 604800 && $jlneeg < 2592000){
			$jlnxg = floor(abs($jlneeg/604800))." week";
			
			}else if($jlneeg > 2592000){
			$jlnxg = floor(abs($jlneeg/2592000))." month";
			
			}else{}
		
?> 
                    
                    <a class="media media-single" href="index.php?go=notif&page=view&kode=<?php echo $kd88; ?>">
					  <span class="avatar avatar-sm bg-blue"><i class="fa fa-info"></i></span>
					  <div class="media-body">
						<p><?php echo $judulnotif; ?></p>
						<time datetime="2017-07-14 20:00"><?php echo $tglen; ?></time>
					  </div>
					</a>
                    
                                            
        
	<?
		}
	?>
            
                    
				  </div>
				</div>
				<!-- /.box-body -->
			  </div>    
              
              
              
              
		  </div>
          
          
          
          
          
          
          
          
          
			
		</div>	
		
		
	</section>
    <!-- /.content -->
    
    