<?php
require_once 'function.php';

session_start();
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");

$id = $_GET["id"] ?? null;
$event_id = $_GET["event_id"] ?? get_active_event_id();

if (!$event_id || ( !$id && intval($id) < 0 )) {
  echo json_encode([
    "status" => false,
    "message" => "forbidden or invalid parameters!",
    "data" => []
  ]);
  exit;
} else {
  $data = query("SELECT * FROM comment_id WHERE no_id > $id AND event_id = '$event_id'");
  echo json_encode([
    "status" => true,
    "message" => "berhasil!",
    "event_id" => $event_id,
    "data" => $data
  ]);
  exit;
}

