<?php
include '../config/database.php';
function _users($mid){
	$conn = _connectDB();
	$sql = "SELECT * FROM groupline WHERE groupline_products = 'ALL' AND groupline_api_key='".$mid."'";
	$result = $conn->query($sql);
	$res = [];
	$newdata = [];
	$newdata['groupline_status'] = false;
	if ($result->num_rows > 0) {
	    while($row = $result->fetch_assoc()) {
	    	$newdata['groupline_status'] = true;
	    	$newdata['groupline_id'] = $row['groupline_id'];
	    	$newdata['groupline_name'] = $row['groupline_name'];
	    	$newdata['groupline_api_key'] = $row['groupline_api_key'];
	    	$newdata['groupline_countdown'] = $row['groupline_countdown'];
	    	$newdata['groupline_alldate'] = $row['groupline_alldate'];
	    }
	}


	$sql2 = "SELECT * FROM notify_login WHERE n_groupid='".$mid."'";
	$result2 = $conn->query($sql2);
	$newdata['notify_status'] = false;
	if ($result2->num_rows > 0) {
	    while($row2 = $result2->fetch_assoc()) {
	    	$newdata['notify_status'] = true;
	    	$newdata['n_no'] = $row2['n_no'];
	    	$newdata['n_groupid'] = $row2['n_groupid'];
	    	$newdata['n_name'] = $row2['n_name'];
	    	$newdata['n_register'] = $row2['n_register'];
	    }
	}
	array_push($res,$newdata);
	return $res;
}
echo json_encode(_users($_GET['mid']));
?>
