MOON
Server: Apache
System: Linux smtp.modiva.org 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64
User: rtbrisc (1005)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/rtbrisc/public_html/admin/main/worker/workers/cancel.php
<?php
session_start();
require_once('server/customer.php'); // Connection variable ($cus)
require_once('server/utilities.php'); // Connection variable ($utl)
require_once('server/issues.php'); // Connnection Variable ($iss)
require_once('server/customercare.php'); // Connnection Variable ($ccs)

$tid = $_GET['tid'];
$request = $_GET['req'];
$tech = $_GET['tech'];

if(empty($tid)){
	$_SESSION['log_err'] = "Unauthorised Operation";
	header("Location: ../../../account/login.php");
}else{
	if($request == "helpdesk"){
		$check = mysqli_query($iss, "SELECT * FROM tblhelpdeskrequest WHERE TicketID = '$tid'");
		$seen = mysqli_fetch_assoc($check);

		if($seen){
			$cancel = mysqli_query($iss, "UPDATE tblhelpdeskrequest SET StatusFlag = 2 WHERE TicketID = '$tid'");
			$trip = mysqli_query($iss, "UPDATE tblsupporttrip SET TaskStatus = 2 WHERE TicketID = '$tid'");
			$technician = mysqli_query($ccs, "UPDATE tbltechnician SET Availabilty = 0 WHERE TechnicianID = '$tech'");

			if($cancel && $trip && $technician){
				$_SESSION['req_suc'] = "Request ID " . $tid . " has been CANCELLED sucessfully";
				header("Location: ../../helpdesk/success.php");
			}else{
				$_SESSION['det_err'] = "Request ID " . $tid . " could not be CANCELLED. Please contact our customer care.";
				header("Location: ../../helpdesk/update.php?tid=$tid");
			}
		}else{
			$_SESSION['det_err'] = "Request ID " . $tid . " could not be be verified. Please contact our customer care.";
			header("Location: ../../helpdesk/update.php?tid=$tid");
		}
	}elseif($request == "project"){
		$check = mysqli_query($iss, "SELECT * FROM tblprojects WHERE TicketID = '$tid'");
		$seen = mysqli_fetch_assoc($check);

		if($seen){
			$cancel = mysqli_query($iss, "UPDATE tblprojects SET StatusFlag = 2 WHERE TicketID = '$tid'");

			if($cancel){
				$_SESSION['req_suc'] = "Project ID " . $tid . " has been CANCELLED sucessfully";
				header("Location: ../../project/success.php");
			}else{
				$_SESSION['det_err'] = "Project ID " . $tid . " could not be CANCELLED. Please contact our customer care.";
				header("Location: ../../project/update.php?tid=$tid");
			}
		}else{
			$_SESSION['det_err'] = "Project ID " . $tid . " could not be be verified. Please contact our customer care.";
			header("Location: ../../project/update.php?tid=$tid");
		}
	}else{
		$_SESSION['log_err'] = "Unknown / Unauthorised Request";
		header("Location: ../../../account/login.php");	
	}
}

?>