<?php
 	session_start(); 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
	
	/* if($_SESSION['utype']!='admin')
	{
		header('Location: index.php');
		return;
	} */
$cmpmid=$_SESSION['linkarisecmpmid'];

	$brmid = $_SESSION['linkarisebranchid'];
	$umid = $_SESSION['linkariseumid'];
	
	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));
	
	
	include("connect.php");
	include("connectp.php");
	include("removespecial.php");
	
	date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y-m-d H:i:s');
	$mdate1= date('Y-m-d');
	
	$umid=$_SESSION['linkariseumid'];

	$slotname=removespecialchar($_POST['slotname']);
	
	$starttime=date("H:i:s", strtotime($_POST['starttime']));
	$endtime=date("H:i:s", strtotime($_POST['endtime']));
	
	


	
	
	
		$eve2 = "INSERT INTO res_slots_master (cmpmid,slotname,slotstarttime,slotendtime) VALUES('$cmpmid','$slotname','$starttime','$endtime')";
		if ($conn->query($eve2) === TRUE)
		{
			$last_id = $conn->insert_id;
			
			
    }

			
			
			
		
		/* generate_followup_sms(); */
		
		$_SESSION['msg'] = "Record saved successfully";
	
			header("Location: slots.php");
		

?>