forked from maiz-an/PlaySphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreceipt.php
More file actions
32 lines (27 loc) · 860 Bytes
/
receipt.php
File metadata and controls
32 lines (27 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
session_start();
// Validate receipt details
if (!isset($_SESSION['receipt_details'])) {
header("Location: booking.php");
exit();
}
$receiptDetails = $_SESSION['receipt_details'];
unset($_SESSION['receipt_details']); // Clear session after use
$receiptData = <<<EOT
Booking Receipt
====================
Customer ID: {$receiptDetails['customer_id']}
Futsal ID: {$receiptDetails['futsal_id']}
Start Time: {$receiptDetails['start_time']}
End Time: {$receiptDetails['end_time']}
Total Cost: {$receiptDetails['total_cost']}
Payment ID: {$receiptDetails['payment_id']}
====================
Thank you for your payment!
EOT;
$fileName = "Booking_Receipt_{$receiptDetails['payment_id']}.txt";
header('Content-Type: text/plain');
header("Content-Disposition: attachment; filename=\"$fileName\"");
// Output the receipt data
echo $receiptData;
exit();