<?php
	session_start();

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

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

	if(mysqli_num_rows($re) > 0)
	{
		while($rt = mysqli_fetch_assoc($re))
		{
			if($rt['cstatus']=='Active')
			{
				$eve1 = "update res_communication_master set cstatus='Inactive' where commid=".$_GET['id'];
				$re1 = mysqli_query($conn, $eve1);
			}
			else
			{		
				$eve1 = "update res_communication_master set cstatus='Active' where commid=".$_GET['id'];
				$re1 = mysqli_query($conn, $eve1);
			}
		}
	}
	$_SESSION['msg'] = " Status Changed";
	
	
	if($_SESSION['frompage']== 'SMS')
	{
	header('Location: template.php');
	}else{
		header('Location: emailtemplate.php');
	}
	
?>