<?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)
    {
        // $cp = array();
        $sels = $con->query("select * from feedback where shop_id='$shop_id' and shop_code='$shop_code'");
        while($rows = $sels->fetch_assoc())
        {
            $cat =  $con->query("select name,mobile from user where id=".$rows['uid']." and shop_id='$shop_id' and shop_code='$shop_code'");
        	if($row = $cat->fetch_assoc())
        	{
        	    $p['name'] = $row['name'];
                $p['mobile'] = $row['mobile'];
        	}
        	$p['rate'] = $rows['rate'];
        	$p['message'] = $rows['msg'];
        	$time = $rows['timestamp'];
        	$dateee = date("d-m-Y", strtotime($time));
        	$p['d_date'] = $dateee;
        	$cp[] = $p;
        }
        
        echo json_encode($cp);
    }
    else
    {
        $rows = array('status'=>"",'message' => 'Data Error');
        echo json_encode($rows);
    }
}

?>