<?php
 	session_start(); 

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



$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	
	include("connect.php");
include("mylibrary.php");
	
	//$visatype=$_POST['visatype'];
	
	$visatype= checkvalidstring($_POST['visatype']);
	
	
	$visatypedesc=checkvalidstring($_POST['visatypedesc']);
	
		
	$eve = "select * from res_visatype_master where visatype='$visatype'";
	$re = mysqli_query($conn, $eve);
	if(mysqli_num_rows($re) > 0)
	{
		$_SESSION['msg1'] = "Service Already Inserted.";
		header('Location: visatype.php');
	}
	else
	{	
		$eve1 = "INSERT INTO res_visatype_master (visatype, visatypedesc ) VALUES('$visatype','$visatypedesc')";
		$re1 = mysqli_query($conn, $eve1);
			
	$_SESSION['msg'] = "Record saved successfully";
	header('Location: visatype.php');
			
	}
?>