<?php
include 'header.php';

$sql211= "SELECT COUNT(id) as count_id FROM users";
$result211 = mysqli_query($link,$sql211);
$row11 = mysqli_fetch_assoc($result211);
if($row11['count_id'] != ""){
  $all_users = $row11['count_id'];
}else{
  $all_users = 0;
}

$sql = "SELECT SUM(amount) as sum_send FROM transaction WHERE type = 'Send' ";
$result = mysqli_query($link,$sql);
$row1 = mysqli_fetch_assoc($result);
if($row1['sum_send'] != ""){
  $total_send = $row1['sum_send'];
}else{
  $total_send = 0;
}

$sql1 = "SELECT SUM(amount) as sum_receive FROM transaction WHERE type = 'Receive' ";
$result1 = mysqli_query($link,$sql1);
$row11 = mysqli_fetch_assoc($result1);
if($row11['sum_receive'] != ""){
  $total_receive = $row11['sum_receive'];
}else{
  $total_receive = 0;
}

$sql21 = "SELECT COUNT(id) as stake_id FROM stakes WHERE status = 'Active' ";
$result21 = mysqli_query($link,$sql21);
$row11s = mysqli_fetch_assoc($result21);
if($row11s['stake_id'] != ""){
  $active_stakes = $row11s['stake_id'];
}else{
  $active_stakes = 0;
}
?>

        <!-- Content wrapper scroll start -->
        <div class="content-wrapper-scroll">

          <!-- Content wrapper start -->
          <div class="content-wrapper">

            <!-- Row start -->
            <div class="row">
              <div class="col-xxl-6 col-sm-6 col-12">
                <div class="stats-tile">
                  <div class="sale-icon shade-red">
                    <i class="bi bi-people"></i>
                  </div>
                  <div class="sale-details">
                    <h3 class="text-red"><?php echo $all_users ?></h3>
                    <p>Total User</p>
                  </div>
                </div>
              </div>
           
        
              <div class="col-xxl-6 col-sm-6 col-12">
                <div class="stats-tile">
                  <div class="sale-icon shade-green">
                    <i class="bi bi-handbag"></i>
                  </div>
                  <div class="sale-details">
                    <h3 class="text-green"> <?php echo number_format($total_send, 2) ?> USD </h3>
                  
                    <p>Total Send Transaction</p>
                  </div>
                </div>
              </div>

              <div class="col-xxl-6 col-sm-6 col-12">
                <div class="stats-tile">
                  <div class="sale-icon shade-green">
                    <i class="bi bi-handbag"></i>
                  </div>
                  <div class="sale-details">
                    <h3 class="text-green"><?php echo number_format($total_receive, 2) ?> USD </h3>
                    <p>Total Receive Transaction</p>
                  </div>
                </div>
              </div>

              <div class="col-xxl-6 col-sm-6 col-12">
                <div class="stats-tile">
                  <div class="sale-icon shade-green">
                    <i class="bi bi-handbag"></i>
                  </div>
                  <div class="sale-details">
                    <h3 class="text-green"><?php echo $active_stakes ?> </h3>
                    <p>Active Stakes</p>
                  </div>
                </div>
              </div>

             

             

             

            </div>

            <!-- Row end -->

            

         
   
<?php 
  include 'footer.php';
 ?>