<?php
 	session_start(); 

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


date_default_timezone_set("Asia/Kolkata");
	$mdate1= date('Y-m-d H:i:s'); 
$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	$umid1 = $_SESSION['umid'];
	
	include("connect.php");
include("mylibrary.php");
	
	//$batchname=$_POST['batchname'];
	$subservicemid= $_POST['subservicemid'];
	$umid= $_POST['umid'];
	$branchmid= $_POST['branchmid'];
	$batchname=checkvalidstring ($_POST['batchname']);
	$batchtiming=checkvalidstring ($_POST['batchtiming']);
	$batchstartdate= date("Y-m-d",strtotime($_POST['batchstartdate']));
	$batchenddate= date("Y-m-d",strtotime($_POST['batchenddate']));
	
	
	
	
	$attechment="";
	/* if(empty($_FILES['attechment']['name']) == false  )
	{
		$attechment = date("YmdHis").$_FILES['attechment']['name'];
		$path = "docs/";
		move_uploaded_file( $_FILES['attechment']['tmp_name'], $path ."/". $attechment );
	
	}
	 */
	
	
		
		
		$eve1 = "INSERT INTO res_batch_master (batchname,batchstartdate,batchenddate,batchtiming,subservicemid,umid,baddedon,baddedby,bupdatedon,bupdatedby,branchmid) VALUES('$batchname','$batchstartdate','$batchenddate','$batchtiming','$subservicemid','$umid','$mdate1','$umid1','$mdate1','$umid1','$branchmid')";
		$re1 = mysqli_query($conn, $eve1);
			
	$_SESSION['msg'] = "Record saved successfully";
	header('Location: batch.php');
			
	
?>