<?php
 	session_start(); 

	if(!isset($_SESSION['atcrmsuloginsesion']))
	{
		header('Location: index.php');
		return;
	}
	if($_SESSION['atcrmsutype']!='Superuser'){
			header('Location: index.php');
		return;
	}
	
	if($_SERVER['REQUEST_METHOD'] === 'POST')
	{
		if(!isset($_POST['_token']) || ($_POST['_token']!==$_SESSION['_token'] ) )
		{
			header('Location: index.php');
			return;
		}
	}
	else
	{
		header('Location: index.php');
		return;
	}
	$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	include("connect.php");

	$smid=$_POST['smid'];
	$smessage=$_POST['smessage'];
	$mumid=$_SESSION['latcmumid']; 
	
	$eve = "update res_suggestion_master set smessage='$smessage' where smid=$smid";
	if ($conn->query($eve) === TRUE)
	{	
		$_SESSION['msg'] = "Record has been updated successfully";
			
	}
	else
	{
		$_SESSION['msg1'] = "Record has been updated successfully";

	}
	header('Location: suggestion.php');

?>