//if user is not logged in, return to log in form if (!is_logged_in()) { header("Location: loginform.php"); } $user = $_SESSION['user']; if (!isset($_GET['id'])) { die("Illegal Request"); } $id = $_GET['id']; $dbconnection = dbconnection::getConnection(); $garageGateway = new garageTableGateway($dbconnection); $busGateway = new busTableGateway($dbconnection); //get garage by id based on garageID of bus object $garages = $garageGateway->getGarageByBusId($id); //get bus by id based on the id passed in through the url $buses = $busGateway->getBusById($id); if (!$buses) { die("Illegal Request"); } ?> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--javascript script for delete confirmation--> <script src="deleteConfirm.js"></script> </head> <body> <!--Links to my google fonts bootstrap/my own style sheets & javascript scripts-->
require_once 'loginhelper.php'; require_once 'garagesTableGateway.php'; start_session(); //if user is not logged in, return to log in form if (!is_logged_in()) { header("Location: loginform.php"); } $user = $_SESSION['user']; if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!isset($_GET['id'])) { die("Illegal Request"); } $id = $_GET['id']; $dbconnection = dbconnection::getConnection(); $gateway = new busTableGateway($dbconnection); $statement = $gateway->getBusById($id); $garageGateway = new garageTableGateway($dbconnection); $garages = $garageGateway->getGarage(); $row = $statement->fetch(PDO::FETCH_ASSOC); if (!$row) { die("Illegal Request"); } } else { if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($_POST['id'])) { die("Illegal request"); } $id = $_POST['id']; $dbconnection = dbconnection::getConnection(); $garageGateway = new garageTableGateway($dbconnection); $garages = $garageGateway->getGarage();