<?php
defined("BASEPATH") or exit("No direct access allowed");
 $query1 = mysqli_query($con,"select count(*) from produk order by id asc");
   $statusbc1 = mysqli_fetch_array($query1,MYSQLI_NUM);
   $jml1 = $statusbc1[0];
   

if(isset($_POST['download'])){
   $id = mysqli_real_escape_string($con,$id);
   $link = mysqli_real_escape_string($con,$link);
   
   mysqli_query($con,"UPDATE cb_produk SET jmld = jmld + 1 WHERE id = '".$id."'");
   
   echo '<a id="my-hidden-link" href="'.$link.'" style="display: none;"rel="nofollow" target="_blank">hidden link</a>';
}

?>
<div class="card-header">
          
          <nav aria-label="breadcrumb">
                      <ol class="breadcrumb bg-warning text-white-all">
                        <li class="breadcrumb-item"><a href="#"><i class="fas fa-tachometer-alt"></i> Home</a></li>
                        <li class="breadcrumb-item"><a href="#"><i class="far fa-file"></i> Produk Digital</a></li>
                        <li class="breadcrumb-item active" aria-current="page"><i class="fas fa-list"></i> <?php echo "$jml1";?> Bonus </li>
                      </ol>
                    </nav>
					
          </div>
    
     <div class="card-body">
            <div class="alert alert-primary alert-has-icon p-4">
            <div class="alert-icon"><i class="far fa-lightbulb"></i></div>
            <div class="alert-body">
            <div class="alert-title">Petunjuk:</div>
             1. Download semua produk.<br>
            2. Boleh dijual kembali. <br>
            3. Boleh dijadikan bonus pada penjualan produk anda yang lain.<br>
            4. Boleh dijadikan sebagai leads magnet.<br>
            5. Boleh mengedit, menggantinya dengan nama anda.
            </div>
            </div>
    </div> 
    
    
    
            
            <!-- /.box-header -->
    <div class="card-body">
                
                <div class="table-responsive">
				<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Nama Produk</th>
                            <th>Deskripsi</th>
                            <th>Download</th>
                        </tr>
                    </thead>
                    <tbody>
                       <?php
                            
                            
                            $qu=mysqli_query($con,"select nama,diskripsi,url_file,id from produk order by id asc");
                            while($data=mysqli_fetch_row($qu)){
                                
                                If ($download =='Y'){
                                    $down ='<a href ="'.$data[2].'" target="_blank"> <b>Download</b> </a>';
                                }else{
                                    $down ='<b>Maaf, Beli Auto dapat bonus ini</b>';
                                }
                                
                                echo "
                                <tr>
                                    
                                    <td>
                                        $data[0] 
                                    </td>
                                    <td>
                                        $data[1] 
                                    </td>
                                    <td>
                                        $down
                                    </td>
                                </tr>
                                ";
                            }
                       ?>
                    </tbody>
                </table>
                </div>
                
            </div>
            <!-- /.box-body -->
        
    <!-- /.col -->

