<?php
session_start(); 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
	
	
	
	
	$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	
	include("connect.php");
	include("connectp.php");
	date_default_timezone_set("Asia/Kolkata");
	$mdate= date('Y-m-d H:i:s');
	$mdate1= date('Y-m-d');

	$tmid=(int)mysqli_real_escape_string($conn,$_POST['tmid']);
	$umid=$_SESSION['linkarieumid'];

	
	 $eve2 = "update res_task_master set taskstatus='Closed',taskcomplatedon='$mdate', taskcomplatedby='$umid' where tmid=$tmid and taskstatus='Open'";
	if ($conn->query($eve2) === TRUE)
	{
		
		$_SESSION['msg'] = "Task Status changed";
	}
	else
	{
		$_SESSION['msg1']="Error";
	}
	
	header("Location: taskstatus.php?tmid=$tmid");
?>	