<?php
header('Content-type: application/json');
include '../config/database.php';
function _users($gid,$product){
	$conn = _connectDB();
	$sql = "SELECT * FROM free_bot WHERE gid = '".$gid."' AND product = '".$product."'";
	$result = $conn->query($sql);
	$res = [];
	if ($result->num_rows > 0) {
	    while($row = $result->fetch_assoc()) {
			array_push($res,$row);
	    }
	} else {
	    echo "";
	}
	return $res;
}
if( isset($_GET['p']) AND isset($_GET['gid'])){
	$product = $_GET['p'];
	$gid = $_GET['gid'];	
	echo json_encode(_users($gid,$product));
}else{
	echo json_encode([]);
}
