<?php
   
    // include config file
   
     require_once 'config.php';
    
    $fromTime = $toTime = "";

    $object = new \stdClass();
    $tame = "";
    
    // check connection
     if($connection === false)
    {
            
            die("ERROR: Could not connect. " . mysqli_connect_error());
            
    }

    date_default_timezone_set("Asia/Karachi");
    
   
   if($_SERVER["REQUEST_METHOD"] == "POST"){

     
     
       $fromTime = trim($_POST["from"]);
       $toTime = trim($_POST["to"]);
      
   
       
      
         $status = "Active";
       
         $query  = "SELECT sum(AdminShare)as ReceivedShare  FROM `tbl_task` 
                    WHERE IsPaid = 'true' 
                    and Time >= '$fromTime 00:00:00'  and Time <= '$toTime 23:59:59' ";

         $result = mysqli_query($connection, $query);
         $db_data = array();

         $data_size = mysqli_num_rows($result);
         
    
        if($data_size > 0){

         while($row = $result->fetch_assoc()){
             $db_data[] = $row;
         }

         echo json_encode($db_data);

       }else {
           
       
               
               $object->status  =  "failed";
               $object->message  = "No data found!";
            
            
               $json = json_encode($object);
               echo $json;

     
           
           
               
        }
           

        
     


                    
         
    }else{
     
      echo "<br>";
      echo "Kindly send request with post method!<br>";
      
    }

   
  
   
   
    mysqli_close($connection);

?>