<?php 

require 'db.php';
require 'jwt_utils.php';

$sels = $con->query("select id,shop_name,shop_id,status,shop_code,shop_logo,shop_type,shop_desc from shop_details where status = '1'");
while($rows = $sels->fetch_assoc())
{
    $p['id'] = $rows['id'];
	$p['shop_id'] = $rows['shop_id'];
	$p['shop_code'] = $rows['shop_code'];
	$p['shop_name'] = $rows['shop_name'];
	$p['shop_logo'] = $rows['shop_logo'];
	$p['shop_type'] = $rows['shop_type'];
	$p['shop_desc'] = $rows['shop_desc'];
	
	$headers = array('alg'=>'HS256','typ'=>'JWT');
    $payload = array('user_details'=>$rows,'exp'=>(time() + 60000));
    $jwt = generate_jwt($headers, $payload);
    
    $p['shop_token'] = $jwt;
    
	$cp[] = $p;
}

echo json_encode($cp);
?>