<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
	$user = trim($_POST['User'] ?? '');
	$password = trim($_POST['Password'] ?? '');
	$con = trim($_POST['con'] ?? '');

	if ($user === '' || $password === '' || $con === '') {
		header('Location: login.php?error=1');
		exit;
	}

	// Post/Redirect/Get: bake the consignment number into the URL so the
	// browser's Back button re-issues a plain GET instead of resubmitting
	// the login POST (which fails once the form data is gone from history).
	header('Location: track-results.php?' . http_build_query(['con' => $con]));
	exit;
}

$con = trim($_GET['con'] ?? '');
if ($con === '') {
	header('Location: login.php');
	exit;
}

$conEsc = htmlspecialchars($con, ENT_QUOTES);
$conUrl = urlencode($con);
?>
<!-- PHP version of Track Results.html: consignment number comes from the query string after a Post/Redirect/Get round-trip from login.php -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head><body style="padding-left:50px" topmargin="10px" rightmargin="20px" leftmargin="30px"><br>

<title>Track Results</title>
<link rel="stylesheet" type="text/css" href="./Track Results_files/reports.css">

<font style="color: #fd6003;font-family: Arial,Helvetica;font-size: 12pt;font-weight: bolder;line-height: 20px;">Consignment Status History</font><br>

			<table border="1" cellspacing="1" cellpadding="1" width="655px" id="t1" bordercolor="#C0C0C0">
				<tbody><tr class="r3" style="overflow:hidden;">
					<td colspan="4">
						<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tbody><tr width="45%" class="r3" style="height:18px; overflow:hidden;">
							<td style="padding-left:4px;"><font class="f5"><b>Consignment No: <?php echo $conEsc; ?></b></font>
          </td>

							<td width="33%" align="right" style="padding-right:4px;"><div class="d4"><font class="f5"><b><p></p></b></font></div></td>
		</tr></tbody></table></td></tr><tr class="r4" height="22">	<td style="padding-left:4px;" width="200">Status</td>	<td style="padding-left:4px;" width="125">Date</td>	<td style="padding-left:4px;" width="125">Time</td><td style="padding-left:4px;" width="200">Depot</td></tr><tr style="height:18px; overflow:hidden;">	<td style="padding-left:4px;"><font class="f4">Your shipment data is lodged</font></td>	<td style="padding-left:4px;"><font class="f4">19/03/2025</font></td>	<td style="padding-left:4px;"><font class="f4">15:35</font></td><td style="padding-left:4px;"><font class="f4">Sydney - Enfield</font></td></tr><tr style="height:18px; overflow:hidden;">	<td style="padding-left:4px;"><font class="f4">We're processing your shipment</font></td>	<td style="padding-left:4px;"><font class="f4">19/03/2025</font></td>	<td style="padding-left:4px;"><font class="f4">17:35</font></td><td style="padding-left:4px;"><font class="f4">Sydney - Erskine Park</font></td></tr><tr style="height:18px; overflow:hidden;">	<td style="padding-left:4px;"><font class="f4">We're processing your shipment</font></td>	<td style="padding-left:4px;"><font class="f4">20/03/2025</font></td>	<td style="padding-left:4px;"><font class="f4">06:42</font></td><td style="padding-left:4px;"><font class="f4">Gold Coast</font></td></tr><tr style="height:18px; overflow:hidden;">	<td style="padding-left:4px;"><font class="f4">We're processing your shipment</font></td>	<td style="padding-left:4px;"><font class="f4">20/03/2025</font></td>	<td style="padding-left:4px;"><font class="f4">06:46</font></td><td style="padding-left:4px;"><font class="f4">Gold Coast</font></td></tr><tr style="height:18px; overflow:hidden;">	<td style="padding-left:4px;"><font class="f4">Your shipment's with a driver</font></td>	<td style="padding-left:4px;"><font class="f4">20/03/2025</font></td>	<td style="padding-left:4px;"><font class="f4">09:51</font></td><td style="padding-left:4px;"><font class="f4">Gold Coast</font></td></tr><tr style="height:18px; overflow:hidden;">	<td style="padding-left:4px;"><font class="f4">We've delivered your shipment</font></td>	<td style="padding-left:4px;"><font class="f4">20/03/2025</font></td>	<td style="padding-left:4px;"><font class="f4">12:01</font></td><td style="padding-left:4px;"><font class="f4">Gold Coast</font></td></tr>
				<tr class="r4" height="26">
					   <td colspan="4" align="right" style="padding-right:4px;"><input class="b3" id="viewpod" style="width:130px;" type="button" value="View POD Image" onclick="location='track-results2.php?con=<?php echo $conUrl; ?>';">&nbsp;&nbsp;&nbsp;<input class="b4" type="button" value="Consignment Detail" style="width:130px;visibility:hidden"></td>
				 </tr>
			</tbody></table><br>

</body></html>
