<?php
session_start();
include('../include/connect.php');
if ($_GET['Action'] == "SANG-HR" && isset($_SESSION['username']) && isset($_SESSION['password'])) {
    $notifications_name =  $_GET["notifications_name"];
    $message            =  $_GET["message"];
    $grouptype            =  $_GET["grouptype"];
    $groupby            =  $_GET["groupby"];

    date_default_timezone_set('Asia/Ho_Chi_Minh');
    $insert_query = "INSERT INTO notice(notifications_name,message,active,time,grouptype,groupby)VALUES('" . $notifications_name . "','" . $message . "','1','" . date('Y-m-d H:i:s') . "','" . $grouptype . "','" . $groupby . "')";

    $result = mysqli_query($link, $insert_query);

    header('Content-Type: application/json');
    echo json_encode('ok');
} else {
    header('location:../template/index.php?mod=error');   //redirect đến trang error.php
    exit();
}
