File: /home/rtbrisc/public_html/admin/main/worker/workers/tracking.php
<?php
session_start();
date_default_timezone_set('Africa/Lagos');
require_once('server/customer.php'); // Connection variable ($cus)
require_once('server/utilities.php'); // Connection variable ($utl)
require_once('server/issues.php'); // Connnection Variable ($iss)
$trackID = "QT" . abs(crc32(uniqid()));
$ticketID = mysqli_real_escape_string($iss, $_GET['tid']);
$customerID = mysqli_real_escape_string($iss, $_GET['cid']);
$technicianID = mysqli_real_escape_string($iss, $_GET['tec']);
$pickDate = date('Y-m-d H:i:s a');
if(empty($customerID)){
$_SESSION['log_err'] = "User Account Could Not Be Verified! Please Login and Try Again!";
header("Location: ../../../account/login.php");
}else{
$sql = mysqli_query($cus, "SELECT * FROM tblcustomer WHERE CustomerID = '$customerID'");
$seen = mysqli_fetch_assoc($sql);
if($seen){
//echo $trackID . ", " . $ticketID . ", " . $customerID . ", " . $technicianID . ", " . $pickDate;
if(empty($trackID)|| empty($ticketID) || empty($customerID) || empty($technicianID) || empty($pickDate)){
$_SESSION['tra_err'] = "<p class='text-danger'>Invalid Request From User!!!</p>";
header("Location: ../../track/available.php");
}else{
//echo $trackID . ", " . $ticketID . ", " . $customerID . ", " . $technicianID . ", " . $finishDate;
$track = mysqli_query($iss, "INSERT INTO tbltracking (TrackingID, TicketID, CustomerID, TechnicianID, TrackStatus, PickDate) VALUES ('$trackID', '$ticketID', '$customerID', '$technicianID', 1, '$pickDate')");
$updaterequest = mysqli_query($iss, "UPDATE tblhelpdeskrequest SET TrackStatus = 1 WHERE TicketID = '$ticketID'");
if($track && $updaterequest){
$_SESSION['tra_suc'] = "Your Tracking ID is " . $trackID . ". Please keep it safe.";
header("Location: ../../track/success.php");
}else{
$_SESSION['tra_err'] = "There was a problem logging your tracking request!!!";
header("Location: ../../track/available.php");
}
}
}else{
$_SESSION['log_err'] = "Invalid User Account, Please Re-Login";
header("Location: ../../../account/login.php");
}
}
?>