<?php
	session_start();

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

	
	include("connect.php");
	
	
	$eve = "select * from res_submodule_master where smodulemid=".$_GET['id'];
	$re = mysqli_query($conn, $eve);

	if(mysqli_num_rows($re) > 0)
	{
		while($rt = mysqli_fetch_assoc($re))
		{
			if($rt['smstatus']==1)
			{
				$eve1 = "update res_submodule_master set smstatus=0 where smodulemid=".$_GET['id'];
				$re1 = mysqli_query($conn, $eve1);
			}
			else
			{		
				$eve1 = "update res_submodule_master set smstatus=1 where smodulemid=".$_GET['id'];
				$re1 = mysqli_query($conn, $eve1);
			}
		}
	}
	$_SESSION['msg'] = "submodule Status Changed";
	
	
	header('Location: submodule.php');
	
?>