<?php 

require 'db.php';

if(isset($_GET['sid']) && isset($_GET['token']))
{
    $shop_id = $_GET['sid'];
    $shop_code = $_GET['token'];

    include 'token_check.php';
    
    if($token_check)
    {
        $sels = $con->query("select * from payment where shop_id='$shop_id' and shop_code='$shop_code' order by id DESC");
        while($rows = $sels->fetch_assoc())
        {
            $p['orders'] = $rows['orders'];
        	$p['start_date'] = $rows['start_date'];
        	$p['end_date'] = $rows['end_date'];
        	$p['distance'] = $rows['distance'];
            $p['dis_amount'] = $rows['dis_amount'];
        	$p['subscription'] = $rows['subscription'];
        	$p['total'] = $rows['total_amount'];
        	$p['status'] = $rows['status'];
        	$cp[] = $p;
        }
        echo json_encode($cp);
    }
    else
    {
        $rows = array('status'=>"",'message' => 'Data Error');
        echo json_encode($rows);
    }
}

?>