<?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");
	
	//$smodulename=$_POST['smodulename'];
	$smodulename=checkvalidstring($_POST['smodulename']);
	$smdisplayname=checkvalidstring($_POST['smdisplayname']);
$mmodulemid=$_POST['mmodulemid'];
	
	
	$smiconname=checkvalidstring($_POST['smiconname']);
	$smfilename=checkvalidstring($_POST['smfilename']);
	$smoduletag=checkvalidstring($_POST['smoduletag']);
	$smstatus=1;
	
	
	
	
		
	 $eve = "select * from res_submodule_master where smodulename='$smodulename'";
	$re = mysqli_query($conn, $eve);
	if(mysqli_num_rows($re) > 0)
	{
		$_SESSION['msg1'] = "submodule Code Already Inserted.";
		header('Location: submodule.php');
	}
	else
	{	
		$eve1 = "INSERT INTO res_submodule_master (smodulename,smiconname,smdisplayname,smstatus,smfilename,mmodulemid,smoduletag) VALUES('$smodulename','$smiconname','$smdisplayname','$smstatus','$smfilename','$mmodulemid','$smoduletag')";
		$re1 = mysqli_query($conn, $eve1);
			
	$_SESSION['msg'] = "Record saved successfully";
	header('Location: submodule.php');
			
	}
?>