Dave's public board

This commit is contained in:
2025-04-07 16:27:01 +00:00
parent 391f057824
commit 94010fec01
7 changed files with 251 additions and 32 deletions

116
public.php Normal file
View File

@@ -0,0 +1,116 @@
<?php
include("functions.php");
// Create connection
$conn = connectDb();
// Fetch arrivals for today's date with status 'NEW'
$arrivalsSql = "SELECT ac_reg, ac_type, in_from, TIME_FORMAT(eta, '%H:%i') AS due
FROM submitted
WHERE DATE(eta) = CURDATE() AND status = 'NEW'
ORDER BY eta ASC";
$arrivalsResult = $conn->query($arrivalsSql);
// Fetch departures for today's date with status 'LANDED'
$departuresSql = "SELECT ac_reg, ac_type, out_to, TIME_FORMAT(etd, '%H:%i') AS due
FROM submitted
WHERE DATE(etd) = CURDATE() AND status = 'LANDED'
ORDER BY etd ASC";
$departuresResult = $conn->query($departuresSql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="300">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Swansea Airport - Arrivals & Departures</title>
<link rel="stylesheet" href="public.css">
</head>
<body>
<header>
<img src="assets/logo.png" alt="EGFH Logo" class="left-image">
<h1>Arrivals/Departures Information</h1>
<img src="assets/flightImg.png" alt="EGFH Logo" class="right-image">
</header>
<main>
<!-- Left column with arrivals table -->
<div>
<h2><center>Arrivals</center></h2>
<table>
<thead>
<tr>
<th>Registration</th>
<th>Aircraft Type</th>
<th>From</th>
<th>Due</th>
</tr>
</thead>
<tbody>
<?php if ($arrivalsResult->num_rows > 0): ?>
<?php while ($row = $arrivalsResult->fetch_assoc()): ?>
<tr>
<td><?= htmlspecialchars($row['ac_reg']) ?></td>
<td><?= htmlspecialchars($row['ac_type']) ?></td>
<td><?= htmlspecialchars($row['in_from']) ?></td>
<td><?= htmlspecialchars($row['due']) ?></td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="4">No arrivals found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<!-- Right column with departures table -->
<div>
<h2><center>Departures</center></h2>
<table>
<thead>
<tr>
<th>Registration</th>
<th>Aircraft Type</th>
<th>To</th>
<th>Due</th>
</tr>
</thead>
<tbody>
<?php if ($departuresResult->num_rows > 0): ?>
<?php while ($row = $departuresResult->fetch_assoc()): ?>
<tr>
<td><?= htmlspecialchars($row['ac_reg']) ?></td>
<td><?= htmlspecialchars($row['ac_type']) ?></td>
<td><?= htmlspecialchars($row['out_to']) ?></td>
<td><?= htmlspecialchars($row['due']) ?></td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="4">No departures found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</main>
<footer>
<!-- Footer content -->
<div class="iso-marquee-linkwrap">
<div class="iso-marquee--long iso-marquee">
<!-- Add marquee content here -->
</div>
</div>
</footer>
</body>
</html>
<?php
// Close the database connection
$conn->close();
?>