<?php
include '../config/database.php';

function _users($Version,$Product){
	$conn = _connectDB();
	$sql = "SELECT groupline_show_time,groupline_bank_image,groupline_name2,groupline_welcome,groupline_bank,groupline_theme,groupline_theme_5min,groupline_view,groupline_id,groupline_name,groupline_key,groupline_api_key,groupline_key_notify,groupline_keycode,groupline_countdown,groupline_alldate,groupline_buy_date,groupline_buy_end,groupline_create,groupline_products,groupline_products_5min,groupline_mode,groupline_mode_5min,groupline_duration_start,groupline_duration_end,groupline_date_access,groupline_over_alert,groupline_routing,groupline_block,groupline_encode,groupline_highlight,groupline_text,lock_mode FROM groupline WHERE groupline_access='active' AND groupline_version = '".$Version."' AND groupline_status_5min='run' AND groupline_products_5min = '".$Product."'";
	// groupline_name,groupline_keycode,groupline_text,groupline_theme,groupline_date,groupline_products,groupline_block,groupline_over_alert,groupline_key_notify,groupline_encode,groupline_highlight

	$result = $conn->query($sql);
	$res = [];
	if ($result->num_rows > 0) {
	    while($row = $result->fetch_assoc()) {
			array_push($res,$row);
	    }
	}
	return $res;
}
if(isset($_GET['v']) AND isset($_GET['p']) ){
	$Version = $_GET['v'];
	$Product = $_GET['p'];
	$newOBJ = [];
	foreach (_users($Version,$Product) as $key => $value) {
		//$value['groupline_name'] = $value['groupline_name'].''.decode($value['groupline_name2'],APP); 
		array_push($newOBJ,  $value);
	}
	echo json_encode($newOBJ);
}else{
	echo json_encode([]);
}




// [
// 	{
// 		groupline_dev: null,
// 		lock_mode: "UNLOCK"
// 	},
// 	{
// 		groupline_dev: null,
// 		groupline_welcome: "ON",
// 		lock_mode: "UNLOCK"
// 	}
// ]


// [
// 	{
// 		groupline_dev: null,
// 		groupline_welcome: "ON",
// 		lock_mode: "UNLOCK"
// 	},
// 	{
// 		groupline_dev: null,
// 		groupline_welcome: "ON",
// 		lock_mode: "UNLOCK"
// 	}
// ]









 //echo encode("💙HUAY💙",APP);


// echo decode("h9t5l5q5d2s7k6s5z8m6t6x8k646q7w7j7s7y7q5y8y746z8u786z8i647n7m6n5l3d9u5j5o5",APP); 








  //       groupline_id,
  //       groupline_name,
  //       groupline_key,
  //       groupline_api_key,
  //       groupline_key_notify,
  //       groupline_keycode,
  //       groupline_countdown,
  //       groupline_alldate,
  //       groupline_buy_date,
  //       groupline_buy_end,
  //       groupline_create,
  //       groupline_products,
  //       groupline_mode,
  //       groupline_duration_start,
  //       groupline_duration_end,
  //       groupline_date_access,
  //       groupline_over_alert,
  //       groupline_routing,
  //       groupline_block,
  //       groupline_encode,
  //       groupline_highlight,
		// groupline_text,
  //       lock_mode,
  //       mode_kclub,
  //       mode_kclub_alert,
  //       mode_kclub_mode,
  //       mode_kclub_comment,
  //       mode_kclub_block,
  //       mode_kclub_reset,
  //       mode_arawan,
  //       mode_arawan_alert,
  //       mode_arawan_mode,
  //       mode_arawan_comment,
  //       mode_arawan_block,
  //       mode_arawan_reset,
  //       mode_newyeekee,
  //       mode_newyeekee_alert,
  //       mode_newyeekee_mode,
  //       mode_newyeekee_comment,
  //       mode_newyeekee_block,
  //       mode_newyeekee_reset,
  //       mode_stock,
  //       mode_stock_comment,
  //       mode_stock_reset,
  //       mode_lottovip,
  //       mode_lottovip_alert,
  //       mode_lottovip_mode,
  //       mode_lottovip_comment,
  //       mode_lottovip_block,
  //       mode_lottovip_reset,
  //       mode_yikeevip,
  //       mode_yikeevip_alert,
  //       mode_yikeevip_mode,
  //       mode_yikeevip_comment,
  //       mode_yikeevip_block,
  //       mode_yikeevip_reset,
  //       mode_mawin,
  //       mode_mawin_alert,
  //       mode_mawin_mode,
  //       mode_mawin_comment,
  //       mode_mawin_block,
  //       mode_mawin_reset,
  //       mode_tangtook,
  //       mode_tangtook_alert,
  //       mode_tangtook_mode,
  //       mode_tangtook_comment,
  //       mode_tangtook_block,
  //       mode_tangtook_reset,
  //       mode_huay,
  //       mode_huay_alert,
  //       mode_huay_mode,
  //       mode_huay_comment,
  //       mode_huay_block,
  //       mode_huay_reset,
  //       mode_huay_vip,
  //       mode_richsabet,
  //       mode_richsabet_alert,
  //       mode_richsabet_mode,
  //       mode_richsabet_comment,
  //       mode_richsabet_block,
  //       mode_richsabet_reset,
  //       mode_ruay,
  //       mode_ruay_alert,
  //       mode_ruay_mode,
  //       mode_ruay_comment,
  //       mode_ruay_block,
  //       mode_ruay_reset,
  //       mode_jetsadalotto,
  //       mode_jetsadalotto_alert,
  //       mode_jetsadalotto_mode,
  //       mode_jetsadalotto_comment,
  //       mode_jetsadalotto_block,
  //       mode_jetsadalotto_reset,
  //       mode_chock,
  //       mode_chock_alert,
  //       mode_chock_mode,
  //       mode_chock_comment,
  //       mode_chock_block,
  //       mode_chock_reset,
  //       notify_limit_push,
  //       mode_moomoo,



// groupline_id,groupline_name,groupline_key,groupline_api_key,groupline_key_notify,groupline_keycode,groupline_countdown,groupline_alldate,groupline_buy_date,groupline_buy_end,groupline_create,groupline_products,groupline_mode,groupline_duration_start,groupline_duration_end,groupline_date_access,groupline_over_alert,groupline_routing,groupline_block,groupline_encode,groupline_highlight,lock_mode,mode_kclub,mode_kclub_alert,mode_kclub_mode,mode_kclub_comment,mode_kclub_block,mode_kclub_reset,mode_arawan,mode_arawan_alert,mode_arawan_mode,mode_arawan_comment,mode_arawan_block,mode_arawan_reset,mode_newyeekee,mode_newyeekee_alert,mode_newyeekee_mode,mode_newyeekee_comment,mode_newyeekee_block,mode_newyeekee_reset,mode_stock,mode_stock_comment,mode_stock_reset,mode_lottovip,mode_lottovip_alert,mode_lottovip_mode,mode_lottovip_comment,mode_lottovip_block,mode_lottovip_reset,mode_yikeevip,mode_yikeevip_alert,mode_yikeevip_mode,mode_yikeevip_comment,mode_yikeevip_block,mode_yikeevip_reset,mode_mawin,mode_mawin_alert,mode_mawin_mode,mode_mawin_comment,mode_mawin_block,mode_mawin_reset,mode_tangtook,mode_tangtook_alert,mode_tangtook_mode,mode_tangtook_comment,mode_tangtook_block,mode_tangtook_reset,mode_huay,mode_huay_alert,mode_huay_mode,mode_huay_comment,mode_huay_block,mode_huay_reset,mode_huay_vip,mode_richsabet,mode_richsabet_alert,mode_richsabet_mode,mode_richsabet_comment,mode_richsabet_block,mode_richsabet_reset,mode_ruay,mode_ruay_alert,mode_ruay_mode,mode_ruay_comment,mode_ruay_block,mode_ruay_reset,mode_jetsadalotto,mode_jetsadalotto_alert,mode_jetsadalotto_mode,mode_jetsadalotto_comment,mode_jetsadalotto_block,mode_jetsadalotto_reset,mode_chock,mode_chock_alert,mode_chock_mode,mode_chock_comment,mode_chock_block,mode_chock_reset,notify_limit_push,mode_moomoo




        // groupline_id,groupline_name,groupline_key,groupline_api_key,groupline_key_notify,groupline_keycode,groupline_countdown,groupline_alldate,groupline_buy_date,groupline_buy_end,groupline_create,groupline_products,groupline_mode,groupline_duration_start,groupline_duration_end,groupline_date_access,groupline_over_alert,groupline_routing,groupline_block,groupline_encode,groupline_highlight,groupline_text,lock_mode