<?php

include("user.php");
$username = $_SESSION['username'];
$rolemaster_id = $_SESSION['rolemaster_id'];
require(".././connect.php");

$date = $_REQUEST['date'];
$time = $_REQUEST['time'];
$title = $_REQUEST['title'];
$description = $_REQUEST['description'];
$organizer = $_REQUEST['organizer'];
$amount = $_REQUEST['amount'];

// Get current date
$currentDate = date('Y-m-d');

// Check if provided date is current date or later
if ($date >= $currentDate) {
    $sql = $con->query("INSERT INTO `daily_event`(`id`,`users_id`,`date`, `time`, `title`, `description`, `organizer`, `amount`, `songs`, `created_on`,`createdby`) VALUES (NULL,'$rolemaster_id','$date','$time','$title','$description','$organizer','$amount','-',now(),'$username')");

}
$base_url = '/rythm/homee.php';

if ($sql != '') {
    echo "<script>alert('Save successfully')</script>";
   echo "<script>window.location.href='$base_url';</script>";
    exit;
} else {
    echo "<script>alert('Something Went Wrong')</script>";
    echo "<script>window.location.href='$base_url';</script>";
    exit;
}



?>
