<?php
include("common/header2.php");
include("common/connection.php");


 

if (isset($_GET['type'])) {
  # code...

$type=$_GET['type'];
 if($type == "1")
 {
      $sql="SELECT * FROM  tbl_signup where status='1'   and autopool_level='1'  ORDER BY signup_id DESC ";
$result=mysqli_query($db,$sql);
if(mysqli_num_rows($result)>0);
 }else
 {
      $sql="SELECT * FROM  tbl_signup where status='1' and autopool_level='2'  ORDER BY signup_id DESC ";
$result=mysqli_query($db,$sql);
if(mysqli_num_rows($result)>0);
 }
 
 
 


   
} 
else
{
 $sql="SELECT * FROM  tbl_signup where status='1'  ORDER BY signup_id DESC ";
$result=mysqli_query($db,$sql);
if(mysqli_num_rows($result)>0);




}
 




?>
     <link rel="stylesheet" type="text/css"  href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
     <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.3.2/css/buttons.dataTables.min.css">

        <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">-->
            <!--            <h4 class="page-title">Member </h4>-->
            <!--            <div class="ml-auto text-right">-->
                          
            <!--            </div>-->
            <!--        </div>-->
            <!--    </div>-->
            <!--</div>-->
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-12">
                        
                        <div class="card">
                            <div class="card-body">
                                <h5 class="card-title">Active Member</h5>
                                <div class="table-responsive">
                               <table id="example" class="display nowrap" style="width:100%">
                                        <thead>
                                            <tr>
                                                <th>Sno.</th>
                                                <th>Name</th>
                                                 <th>Sponsor Code</th>
                                                
                                                    <th>Sponsor Id</th>
                                                      <th>Mobile</th>
                                                       <th>Wallet Amount</th>
                                                          <th>Fund Amount</th>
                                           <!--   <th>Autopool</th>-->
                                           <!--<th>Autopool  1 Level</th>-->
                                           <!--  <th>Autopool  2 Level</th>-->
                                             
                                             <th>Created</th>
                                              <th>Active Date</th>
                                                   <th>Active Time</th>
                                            <th>Action</th>  
                                            </tr>
                                        </thead>
                                        <tbody>
                          <?php 
                                             $count=0;
                                             while($row = mysqli_fetch_assoc($result)) {
                                            if($result)
                                                {    $count++; ?>
                                             <tr>
                                            <td><?php echo $count;?></td>
                                             
                                            <td><?php echo $row['name'];?></td>
                                            
  <td><a class="copy_text"  data-toggle="tooltip" title="Copy to Clipboard" href="<?php echo $row['sponsor_code'];?>">RW<?php echo $row['sponsor_code'];?> </a> </td> 

 
 <td><a class="copy_text"  data-toggle="tooltip" title="Copy to Clipboard" href="<?php echo $row['sponsorid'];?>">RW<?php echo $row['sponsorid'];?> </a> </td>
      
 <td><?php echo $row['mobile'];?></td>
  <td><?php echo $row['wallet_amount'];?></td>
  <td><?php echo $row['amount'];?></td>
  <td><?php echo $row['created_date'];?></td>
  <td><?php echo $row['active_date'];?></td>
    <td><?php 
    
      $dateString = $row['active_date'].$row['active_time'];
$dateObject = new DateTime($dateString);
echo $dateObject->format('h:i A');
   ?></td>
                                 <td> 
  

 <a  href="../user_panel/userlogin.php?id=<?php echo $row['sponsor_code'];?>&sing=<?php echo $row['signup_id'];?>" target="_blank">
<button type="button" class="btn btn-warning btn-sm remove"> <i class=" fas fa-eye">User Login Here</i></button> 
</a>

</br></br> 

 <a  href="member-update.php?id=<?php echo $row['sponsor_code'];?>">
<button type="button" class="btn btn-warning btn-sm remove"> <i class=" fas fa-eye">Edit Details</i></button> 
</a>




  </td>
     </tr>
                                        <?php } } ?>
 
                                        </tbody>
                                        
                                    </table>
                                </div>

                            </div>
                        </div>
                        
                        
                        <!--new data table work from hrere-->
                        



                        
                        </div>
                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- footer -->
            <!-- ============================================================== -->
                      <?php
include("common/footer.php");
?>
      <?php
include("common/footer.php");
?>
  <!--<script src="assets/extra-libs/DataTables/datatables.min.js"></script>-->
  <!--   <link href="assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.css" rel="stylesheet">-->
  <!--  <link href="dist/css/style.min.css" rel="stylesheet">-->
  <!--   <script>-->
  <!--      /****************************************-->
  <!--       *       Basic Table                   *-->
  <!--       ****************************************/-->
  <!--      $('#zero_config').DataTable();-->
  <!--  </script>-->
       <script type='text/javascript' src="https://code.jquery.com/jquery-3.5.1.js"></script>
                         
                                <script type='text/javascript' src='https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js'></script>
                                <script type='text/javascript' src='https://cdn.datatables.net/buttons/2.3.2/js/dataTables.buttons.min.js'></script>
                                <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js'></script>
                                <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js'></script>
                                <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js'></script>
                                <script type='text/javascript' src='https://cdn.datatables.net/buttons/2.3.2/js/buttons.html5.min.js'></script>
                                <script type='text/javascript' src='https://cdn.datatables.net/buttons/2.3.2/js/buttons.print.min.js'></script>
    
    <script>
        $(document).ready(function() {
    $('#example').DataTable( {
    dom: 'Bfrtip',
    buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
    ]
    } );
} );
        </script>
    