<?php
// header('Content-type: application/json');
// include '../../config/database.php';
// function _users_mode($mid,$product,$mode){
// 	$conn = _connectDB();
// 	$sql = "UPDATE groupline SET ".$product."='".$mode."' WHERE groupline_api_key='".$mid."'";
// 	$result = $conn->query($sql);
// 	$res = ['status'=>true];
// 	return $res;
// }
// if(isset($_GET)){
// 	if(isset($_GET['mid'])){
// 		$mid = $_GET['mid'];
// 		$product = $_GET['product'];
// 		$mode = $_GET['mode'];
// 		echo json_encode(_users_mode($mid,$product,$mode));
// 	}
// }
header('Content-type: application/json');
include '../../config/database.php';
function _users_mode_huay($gid,$mode,$product,$view){
	$conn = _connectDB();
	$sql = "UPDATE groupline SET groupline_view='".$view."',groupline_theme='".$mode."' WHERE groupline_products = '".$product."' and  groupline_key='".$gid."'";
	$result = $conn->query($sql);
	$res = ['status'=>true];
	return $res;
}

if(isset($_GET)){
	if(isset($_GET['gid'])){
		$gid = $_GET['gid'];
		$mode = $_GET['mode'];
		$product = $_GET['p'];
		$view = $_GET['view'];
		echo json_encode(_users_mode_huay($gid,$mode,$product,$view));
	}else{echo json_encode(['status'=>false]);}
}else{echo json_encode(['status'=>false]);}