<?php
 	session_start(); 

	if(!isset($_SESSION['latcsuperloginsesion']))
	{
		header('Location: index.php');
		return;
	}

	
	if($_SERVER['REQUEST_METHOD'] === 'POST')
	{
		if(!isset($_POST['_token']) || ($_POST['_token']!==$_SESSION['_token'] ) )
		{
			header('Location: index.php');
			return;
		}
	}
	else
	{
		header('Location: index.php');
		return;
	}
	$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	date_default_timezone_set("Asia/Kolkata");
				$mdate1= date('Y-m-d H:i:s');
	
	include("connect.php");

	$tmessage=$_POST['tmessage'];
	$mumid=$_SESSION['latcmumid']; 
	
	$eve1 = "INSERT INTO res_ticket_master (tmessage,mumid,taddedon,tstatus) VALUES('$tmessage',$mumid,'$mdate1','Pending')";
	$re1 = mysqli_query($conn, $eve1);
		
	$_SESSION['msg'] = "Record saved successfully";
	header('Location: ticket.php');
?>