<?php
include "common/header.php";
$mydownline = getmydownline($user_id);
 $mydirect = getmydirectid($user_sponsor_code);
$mydownlineactive = getmydownlineactive($user_id);
$directactive = getmydirectactive($user_sponsor_code);
  $giftlist = giftlist($user_sponsor_code);
 

$mynews = getnews($userid);
$news = $mynews['news'];
$sql1="select * from tbl_bank where user_id='$user_sponsor_code'";
$result1=mysqli_query($db,$sql1);
 if(mysqli_num_rows($result1)>0);
   while($row = mysqli_fetch_assoc($result1)) {
    if($result1){
        
       $user_name = $row["user_name"];
         $bank_name = $row["bank_name"];
    $ifsc= $row["ifsc"];
    
    $user_name=$row["user_name"];
      $account_no=$row["account_no"];
      
    
    
  
   }} 



  
?>
        <!-- ============================================================== -->
        <!-- End Left Sidebar - style you can find in sidebar.scss  -->
        <!-- ============================================================== -->
        <!-- ============================================================== -->
        <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
             <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-12 d-flex no-block align-items-center">
                       <div class="col-md-2"> <h4 class="page-title">Dashboard </h4></div>
<?php if ($autopool_level=="") { ?>
  
   <div class="col-md-10" style="text-align: center; color: white; padding: 10px; background: #f0811f; border-radius: 7px;">
       
       <h4 class="page-title"><a href="autopool-upgrade.php" style="color:white">UPGRADE TO AUTO POOL 1 CLUB
       <p>
       Dear User, Currently You Are Not in Club. Upgrade Cost are 300. If you have 300 or more fund in your wallet. Click here to Upgrade You Account.
       </p>
       
       </a></h4>
       
       
       </div>

   <?php  } elseif($autopool_level=="1") {  ?>
   <div class="col-md-10" style="text-align: center; color: white; padding: 10px; background: #f0811f; border-radius: 7px;">
       
       
          <h4 class="page-title"><a href="autopool-upgrade.php" style="color:white">UPGRADE TO AUTO POOL 2 CLUB
       <p>
       Dear User, Currently You Are Not in Club. Upgrade Cost are 600. If you have 600 or more fund in your wallet. Click here to Upgrade You Account.
       </p>
       
       </a></h4>
         </div>
       
       
       

   <?php   } elseif ($autopool_level=="2") {  ?>
   
   
    <div class="col-md-10" style="text-align: center; color: white; padding: 10px; background: #f0811f; border-radius: 7px;">
       
       
          <h4 class="page-title"><a href="autopool-upgrade.php" style="color:white">UPGRADE TO AUTO POOL 3 CLUB
       <p>
       Dear User, Currently You Are Not in Club. Upgrade Cost are 1000. If you have 1000 or more fund in your wallet. Click here to Upgrade You Account.
       </p>
       
       </a></h4>
         </div>
         
         
         <?php }  ?>

            
                          
                  
                </div>
            </div>
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Sales Cards  -->
                <!-- ============================================================== -->
                <div class="row">
                    
                  
                     <!-- News -->
                     
                     
                                  
                     <!-- News -->
                     <?php
                     $sqlact="select * from tbl_signup where sponsor_code= '$user_sponsor_code' ";
$resultact=mysqli_query($db,$sqlact);
 if(mysqli_num_rows($resultact)>0);
   while($rowact = mysqli_fetch_assoc($resultact)) {
    if($resultact){
        
       $statusac = $rowact["status"];
      
    
    
  
   }} 
   

   
   $time1=date("H:i:s");
  $date1 = new DateTime($created_time);
$date2 = $date1->diff(new DateTime($time1));
   
//   $date1 = strtotime($created_time);  
// $date2 = strtotime($time);  
  

//  $diff = abs($date2 - $date1); 

     $difftime=$date2->h;
    
     if($statusac == '0'){
         
         
      ?>
   
                      <div class="col-md-12 col-lg-12 col-xlg-12">
                                        <div class="card">
                            <div class="card-body">
                                 <marquee><h4 class="card-title m-b-0" style="color: red;">Activation Pending...  </h4> </marquee>

                            </div>
                             <ul class="list-style-none">
                                <li class="d-flex no-block card-body">
                                 <h5 style="
    color: red;
">ID ACTIVATION PENDING CLICK HERE TO ACTIVATE.<a href="verify-act.php">  <b style="color: blue;">Click Here </b></a>  </h5> 
                                </li>
                             
                            </ul>
                        </div>
                    </div>
                    
                    
   <?php 
 if($difftime >= 24){
             $sql5 = "update tbl_signup set status='3'  where signup_id ='$user_id' ";
               
  $result5=mysqli_query($db,$sql5);
if ($result5) {
    	echo "<script>alert('Your Activation was over. Plz Contact Admin');window.location.assign('login.php');</script>";	
   
} else {
    $error= "Error: " . $sql5 . "<br>" . $db->error;
}

}

   
         }
   
   ?> 
                     
                         <div class="col-md-8 col-lg-10 col-xlg-12">
                       <div class="card">
                            <div class="card-body">
                                <h4 class="card-title m-b-0">Member News </h4>
                            </div>
                             <ul class="list-style-none">
                                <li class="d-flex no-block card-body">
                                  <marquee><?php echo $news;  ?></marquee>
                                </li>
                             
                            </ul>
                        </div>
                    </div>
          
                            <div class="col-md-6 col-lg-2 col-xlg-3">
                        <div class="card card-hover">
                            <div class="  text-center">
                           
 <img src="<?php echo $hmwhatsapp;?>" height="99px" />
  <h6 class="text-white"><a  href="whatsapp://send?text= Hello, Welcome to  <?php echo $hmtitle; ?>.follow this link for joining  <?php echo $hmurl; ?>software/user/register?sponid=<?php echo $hmpre.$user_sponsor_code; ?>"  data-action="share/whatsapp/share" style="color:#28b779">Share Your Link</a></h6> 
                            </div>
                        </div>
                    </div> 
                     
                             <div class="col-md-6 col-lg-2 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-danger text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-marker-check"></i></h1>
                                 <h6 class="text-white">Single Leg Level</h6>
                                 <h4 class="text-white"> <?php echo $my_level; ?> </h4>
                               
                            </div>
                        </div>
                           </div>
                           
                             <div class="col-md-6 col-lg-2 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-cyan text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-wallet"></i></h1>
                                <h6 class="text-white">Wallet Amount</h6>
                                <h4 class="text-white"> <i class="mdi mdi-currency-inr"></i> <?php echo   $user_wallet_amount; ?> </h4>
                                
                            </div>
                        </div>
                    </div>
                        
   
                    
                    
      
                    <div class="col-md-8">
                        
<div class="table-responsive">
  <table class="table table-striped userinfo"  >
 
    <tbody>
         <tr class="success">
        <td><span id="ContentPlaceHolder1_lb">MY Name</span></td>
       <td><span id="ContentPlaceHolder1_lbname"><?php echo $user_namea?> </span></td>
        
        <td><span id="ContentPlaceHolder1_Label1">MY User Id</span></td>
        <td><span id="ContentPlaceHolder1_lbname"> <?php echo $hmpre.$user_sponsor_code?> </span></td>
      </tr>  
        <tr class="danger">
        <td><span id="ContentPlaceHolder1_Label1012">MY Sponser ID</span></td>
        <td><span id="ContentPlaceHolder1_lbsponser"> <?php echo $hmpre.$user_sponsorid?></span></td>
        <td><span id="ContentPlaceHolder1_Label1112">Sponser Name</span></td>
             <td><span id="ContentPlaceHolder1_lbsname"> <?php echo $user_sponsorname?></span></td>
      </tr>
      <tr class="danger">
        <td><span id="ContentPlaceHolder1_Label2">Registration Date</span></td>
        <td><span id="ContentPlaceHolder1_lbdateregistration"><?php echo $created_date?> </span></td>
        <td><span id="ContentPlaceHolder1_Label8">Active Date</span></td>
         <td><span id="ContentPlaceHolder1_lbdateactive"><?php echo $active_date ?></span></td>
      </tr>
      
    </tbody>
  </table>
</div>

                    </div>
                    
                   
                </div>
                <div class="row">
         
                    <!-- Column -->
                    <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-success text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-chart-areaspline"></i></h1>
                                <h6 class="text-white">My Downline</h6>
                                <h3 class="text-white">Total -  <?php echo $mydownline; ?> <span style="font-size: 18px;">( act- <?php echo $mydownlineactive; ?>  )</span> </h3>
                                 
                                
                            </div>
                        </div>
                    </div>
                        <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-warning text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-arrow-right-box"></i></h1>
                                 <h6 class="text-white">My Direct</h6>
                                  <h3 class="text-white">Total -  <?php echo $mydirect; ?>  
                                  </h3>
                               
                                
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-danger text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-receipt"></i></h1>
                                  <h6 class="text-white">After Sponser Downline</h6>
                                  <h3 class="text-white">Total - <?php  echo $after=$mydownline -  $mydirect ?> </h3>
                              
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-cyan text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-receipt"></i></h1>
                                  <h6 class="text-white">Active Direct</h6>
                          <h3 class="text-white"><?php echo $directactive; ?> </h3>
                              
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-success text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-receipt"></i></h1>
                                  <h6 class="text-white">InActive Direct</h6>
                                  <h3 class="text-white">0 </h3>
                              
                            </div>
                        </div>
                    </div>
                   

                    <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-danger text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-receipt"></i></h1>
                                  <h6 class="text-white">Total Income</h6>
                                  <h3 class="text-white">0 </h3>
                              
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6 col-lg-3 col-xlg-3">
                        <div class="card card-hover">
                            <div class="box bg-cyan text-center">
                                <h1 class="font-light text-white"><i class="mdi mdi-receipt"></i></h1>
                                  <h6 class="text-white">Direct Income</h6>
                                  <h3 class="text-white"><?php echo $directactive*10;?> </h3>
                              
                            </div>
                        </div>
                    </div>

        
           
       
 
                    </div>

            
 
 




     <h2>Single Leg Level Table</h2>
   <div class="table-responsive">
   <table class=" table  table-dark tablecolor"  >
    <thead>
      <tr>
        <th>Level</th>
        <th>Req Count</th>
       
          <th>Req Direct</th>
    
              <th>Total Income</th>
              <th> Daily Income</th>
              <th> Total Days</th>
              <th>Status</th>

      </tr>
    </thead>
    <tbody>
        <?php
 $sql="SELECT * FROM  tbl_income";
$result=mysqli_query($db,$sql);
if(mysqli_num_rows($result)>0);


                                           
                                             while($row = mysqli_fetch_assoc($result)) {
                                            if($result)
                                                {   $levelnew=$row['level']  ?>
                                             <tr <?php if($levelnew <= $my_level)  { ?> style="background-color:#28b779;" <?php } ?> >
                                           
                                              <td><?php echo $row['id'];?></td>
                                            <td><?php echo $row['act_team'];?></td>
                                            <td><?php echo $row['direct'];?></td>
                     
                               <td><?php echo $row['income'];?></td>
                                 <td><?php echo $row['daily'];?></td>
                                   <td><?php echo $row['days'];?></td>
                                  <td><?php if($levelnew < $my_level)  { ?> Done <?php } else if($levelnew == $my_level){ echo "ONGOING"; }else { echo "PENDING";} ?></td>
                                
     </tr>
                                        <?php } } ?>
   
  
      
    </tbody>
  </table>
</div>
</div>
 <!-- CHECK NEW CONDITION -->
<?php 
 if($user_sponsor_code !='0' && $user_sponsor_code !='')
         {
$myteam=$mydownlineactive;
$mydirect = $directactive;

  $myteam=10;
// $mydirect=2;
getdirectandteam($myteam,$my_level,$mydirect,$user_sponsor_code); 
paysingleleg($date);

}

$directno=$mydirect;
         
 if($directno>=7)
 {
     
     echo "demofaizna";
   $amount=500;
   $newdirect=7;
  // insertmoneyrewards($amount,$directno,$user_sponsor_code);

 }else  if($directno>=15)
 {
    $amount=700;
    $newdirect=15;
  //  insertmoneyrewards($amount,$newdirect,$user_sponsor_code);
     
 }
 
 else  if($directno>=25)
 {
    $amount=1300;
    $newdirect=25;
  //  insertmoneyrewards($amount,$newdirect,$user_sponsor_code);
     
 }

include "common/footer.php"; ?>
 
