<?php
header('Content-type: application/json');
date_default_timezone_set("Asia/Bangkok");

$servername = "public.05z3l.bkk1.database-hosting.webstarterz.com";
$username = "05z3l_linebot2";
$password = "@Anont0811045107";
$dbname = "05z3l_linebot";

function get_group($token,$limit){
	global $servername;
	global $username;
	global $password;
	global $dbname;
	// Create connection
	$conn = new mysqli($servername, $username, $password, $dbname);
	// Check connection
	if ($conn->connect_error) {
	    die("Connection failed: " . $conn->connect_error);
	}
	$sql = "UPDATE groupline SET notify_limit_push='".$limit."' WHERE groupline_api_key='".$token."'";

	$result = $conn->query($sql);
	$res = ['status'=>true];
	return $res;
}
if(isset($_GET)){
	if(isset($_GET['token'])){
		$token = $_GET['token'];
		$limit = $_GET['limit'];
		echo json_encode(get_group($token,$limit));
	}
}


//ทำต่อพรุ่งนี้