<?php
header('Content-type: application/json');
include '../config/database.php';
function _users($gid,$product){
	$conn = _connectDB();
	// $sql = "SELECT * FROM groupline WHERE groupline_products != 'ALL' AND groupline_key = '".$gid."' AND groupline_status='run' AND groupline_products = '".$product."'";
	$sql = "SELECT * FROM groupline WHERE groupline_products != 'ALL' AND groupline_key = '".$gid."' AND groupline_products = '".$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'];
	$user = _users($gid,$product);
	$bank = decode_account($user[0]['groupline_bank']);
	$user[0]['groupline_bank'] = $bank;
	echo json_encode($user);
	// echo json_encode(_users($gid,$product));
	//print_r($user[0]['groupline_bank']);
}else{
	echo json_encode([]);
}
// cda0b7ff5b7ac1329f1ad6316ae3afc48