General tidy
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
New file
|
|
||||||
10
newppr.php
10
newppr.php
@@ -48,7 +48,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
|
|
||||||
function generatePprEmail($entryId) {
|
function generatePprEmail($entryId) {
|
||||||
|
|
||||||
global $mailHost, $mailSMTPAuth, $mailUsername, $mailPassword, $mailPort, $baseUrl, $mailFromAddress, $mailFromName;
|
global $conn, $mailHost, $mailSMTPAuth, $mailUsername, $mailPassword, $mailPort, $baseUrl, $mailFromAddress, $mailFromName;
|
||||||
$token = generateSecureToken($_POST['email'], $entryId);
|
$token = generateSecureToken($_POST['email'], $entryId);
|
||||||
$secureLink = $baseUrl . "/pilotppr.php?op=view&token=" . urlencode($token);
|
$secureLink = $baseUrl . "/pilotppr.php?op=view&token=" . urlencode($token);
|
||||||
echo $secureLink;
|
echo $secureLink;
|
||||||
@@ -68,16 +68,20 @@ function generatePprEmail($entryId) {
|
|||||||
$mail->addAddress($_POST['email']);
|
$mail->addAddress($_POST['email']);
|
||||||
|
|
||||||
$mail->isHTML(true);
|
$mail->isHTML(true);
|
||||||
$mail->Subject = "PPR Confirmation";
|
$mail->Subject = "PPR Confirmation for " . $_POST['ac_reg'];
|
||||||
$mail->Body = "
|
$mail->Body = "
|
||||||
<p>This is to confirm we have received your PPR. To view or cancel your PPR please click the button:</p>
|
<p>This is to confirm we have received your PPR. To view or cancel your PPR please click the button:</p>
|
||||||
<a href='$secureLink' style='display: inline-block; padding: 10px 20px; color: white; background-color: #007bff; text-decoration: none; border-radius: 5px;'>Edit Entry</a>
|
<a href='$secureLink' style='display: inline-block; padding: 10px 20px; color: white; background-color: #007bff; text-decoration: none; border-radius: 5px;'>View PPR</a>
|
||||||
";
|
";
|
||||||
|
|
||||||
$mail->send();
|
$mail->send();
|
||||||
echo "Email sent successfully!";
|
echo "Email sent successfully!";
|
||||||
|
logJournal($conn, $entryId, "Confirm email sent");
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo "Email sending failed: {$mail->ErrorInfo}";
|
echo "Email sending failed: {$mail->ErrorInfo}";
|
||||||
|
logJournal($conn, $entryId, "Confirm email FAILED");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
15
pilotppr.php
15
pilotppr.php
@@ -7,7 +7,7 @@ include("functions.php");
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Row Details</title>
|
<title>Swansea PPR Details</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
@@ -78,6 +78,10 @@ include("functions.php");
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div class="container" id="message">
|
||||||
|
These details have been submitted as your PPR. We look forward to seeing you at Swansea Airport!<p>To cancel your PPR, use the button below. It is currently not possible to make any changes here, but please feel free to cancel if you need to and create a new PPR.
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (isset($_GET['token'])) {
|
if (isset($_GET['token'])) {
|
||||||
@@ -110,8 +114,7 @@ function opCancel($entryId) {
|
|||||||
$result = $conn->query($sql);
|
$result = $conn->query($sql);
|
||||||
logJournal($conn, $entryId, "Marked Canceled by Pilot");
|
logJournal($conn, $entryId, "Marked Canceled by Pilot");
|
||||||
$conn->close();
|
$conn->close();
|
||||||
echo "<p>Your PPR has been canceled. Thank you for letting us know!</p>";
|
echo'<script>document.getElementById("message").innerHTML = "Your PPR has been canceled. Thank you for letting us know!";</script>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function opView($entryId) {
|
function opView($entryId) {
|
||||||
@@ -145,7 +148,8 @@ function opView($entryId) {
|
|||||||
echo '<button onclick="confirmWithSweetAlert(\'pilotppr.php?op=cancel&token=' . urlencode($_GET['token']) . '\')">Cancel PPR</button>';
|
echo '<button onclick="confirmWithSweetAlert(\'pilotppr.php?op=cancel&token=' . urlencode($_GET['token']) . '\')">Cancel PPR</button>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "<p>No details found for the given ID. This could mean the PPR has been canceled already.</p>";
|
echo "";
|
||||||
|
echo'<script>document.getElementById("message").innerHTML = "No details found for the given ID. This could mean the PPR has been canceled already.";</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$conn->close();
|
$conn->close();
|
||||||
@@ -166,7 +170,8 @@ function confirmWithSweetAlert(url) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#3085d6",
|
confirmButtonColor: "#3085d6",
|
||||||
cancelButtonColor: "#d33",
|
cancelButtonColor: "#d33",
|
||||||
confirmButtonText: "Cancel PPR"
|
confirmButtonText: "Cancel PPR",
|
||||||
|
cancelButtonText: "Keep PPR"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|||||||
Reference in New Issue
Block a user