diff --git a/action.php b/action.php index b333503..9596856 100644 --- a/action.php +++ b/action.php @@ -88,11 +88,45 @@ function opCancel() { } function opLanded() { + + $date = date('Y-m-d'); + $time = urldecode($_GET['time']); + $landed_dt = $date . ' ' . $time; + $conn = connectDb(); - $sql = "UPDATE submitted SET status = 'LANDED', landed_dt = NOW() where id = " . $_GET['id']; - $result = $conn->query($sql); - logJournal($conn, $_GET['id'], "Marked Landed"); + $sql = "UPDATE submitted SET status = 'LANDED', landed_dt = ? WHERE id = ?"; + + $stmt = $conn->prepare($sql); + $stmt->bind_param("si", $landed_dt, $_GET['id']); + + $stmt->execute(); + $stmt->close(); + + logJournal($conn, $_GET['id'], "Marked Landed at time " . $time); + $conn->close(); + +} + +function opDeparted() { + + $date = date('Y-m-d'); + $time = urldecode($_GET['time']); + $departed_dt = $date . ' ' . $time; + + $conn = connectDb(); + $sql = "UPDATE submitted SET status = 'DEPARTED', departed_dt = ? WHERE id = ?"; + + $stmt = $conn->prepare($sql); + $stmt->bind_param("si", $departed_dt, $_GET['id']); + + $stmt->execute(); + $stmt->close(); + + logJournal($conn, $_GET['id'], "Marked Departed at time " . $time); + + $conn->close(); + } function opDelete() { @@ -148,6 +182,9 @@ switch($_GET['op']) { case "landed": opLanded(); break; + case "departed": + opDeparted(); + break; case "delete": opDelete(); break; diff --git a/arrive.png b/arrive.png new file mode 100644 index 0000000..5848b54 Binary files /dev/null and b/arrive.png differ diff --git a/depart.png b/depart.png new file mode 100644 index 0000000..456a16e Binary files /dev/null and b/depart.png differ diff --git a/functions.php b/functions.php index 295757e..788155e 100644 --- a/functions.php +++ b/functions.php @@ -128,9 +128,9 @@ function validateSecureToken($token) { list($email, $entryId, $timestamp, $hash) = explode('|', $decoded); // Check expiration (e.g., valid for 1 hour) - if (time() - $timestamp > 3600) { - return false; - } + //if (time() - $timestamp > 3600) { + // return false; + //} // Verify hash $data = "$email|$entryId|$timestamp"; diff --git a/newppr.php b/newppr.php index 88fc058..4212e18 100644 --- a/newppr.php +++ b/newppr.php @@ -36,7 +36,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { echo "Username is not set."; } - //echo ''; + echo ''; } else { echo "

Error inserting data: " . $conn->error . "

"; } diff --git a/tower.php b/tower.php index 1950a8d..765cf0f 100644 --- a/tower.php +++ b/tower.php @@ -7,6 +7,8 @@ require_db_auth(); + + -

Swansea Inbound PPR

+

Tower Ops

-
+
Inbound PPR
+ connect_error) { die("Connection failed: " . $conn->connect_error); } -$custom_headings = [ - 'column1' => 'Custom Heading 1', - 'column2' => 'Custom Heading 2', - 'column3' => 'Custom Heading 3' - // Add more custom headings as needed -]; - // Define your SQL query -$sql = "SELECT id, status, ac_reg, ac_type, ac_call, TIME_FORMAT(eta,'%H:%i') AS ETA, fuel, in_from, pob_in FROM submitted WHERE DATE(eta) = CURDATE() AND status != 'DELETED' ORDER BY eta ASC;"; // Replace with your table name +$sql = "SELECT id, status, ac_reg, ac_type, ac_call, TIME_FORMAT(eta,'%H:%i') AS ETA, fuel, in_from, pob_in FROM submitted WHERE DATE(eta) = CURDATE() AND (status = 'NEW' OR status = 'CANCELED') ORDER BY eta ASC;"; // Replace with your table name // Execute the query $result = $conn->query($sql); @@ -197,7 +287,7 @@ $result = $conn->query($sql); // Check if there are results if ($result->num_rows > 0) { // Start HTML table - echo ' + echo '
'; @@ -227,7 +317,63 @@ if ($result->num_rows > 0) { } } } - echo ''; + echo ''; + echo ''; + } + + echo '
' . $row['status'] .'
'; +} else { + echo "No results found."; +} + +?> + +
Booking Out
+ +
+ +query($sql); + +// Check if there are results +if ($result->num_rows > 0) { + // Start HTML table + echo ' + + '; + + // Output table headers (assuming column names are known) + $fields = $result->fetch_fields(); + foreach ($fields as $field) { + if ($field->name != 'status' && $field->name != 'id' && $field->name != 'ac_call') { + echo ''; + } + + } + echo ''; + + echo ' + + '; + + // Output table rows + while ($row = $result->fetch_assoc()) { + echo ''; + foreach ($row as $key => $value) { + if ($key != 'status' && $key != 'id' && $key != 'ac_call') { + if ($key == 'ac_reg' && $row['ac_call'] != NULL) { + echo ''; + } else { + echo ''; + } + } + } + echo ''; echo ''; } @@ -241,6 +387,8 @@ $conn->close(); ?> + +
\ No newline at end of file + if (td !== tr.lastElementChild) { + let rowId = tr.dataset.id; // Get the unique row ID + openDetail(rowId); + } + } + + + + +
' . htmlspecialchars($field->name ?? '') . 'actions
' . htmlspecialchars($row['ac_call'] ?? '') . "
" . $value . '
' . htmlspecialchars($value ?? '') . '