Fix: Use EFT ID as filename for POP uploads instead of random filename

- Changed from random filename to eft_id.pdf format for proof of payment files
- Updated sendPOP() and auditLog() calls to use new filename variable
This commit is contained in:
twotalesanimation
2025-12-04 16:11:37 +02:00
parent 716de2f0e9
commit 5f1a6bc441
4 changed files with 26 additions and 6 deletions

View File

@@ -1,4 +1,10 @@
<?php
ob_start(); // Start output buffering
session_start();
// Set JSON response header BEFORE any other output
header('Content-Type: application/json');
$rootPath = dirname(dirname(__DIR__));
require_once($rootPath . "/src/config/env.php");
require_once($rootPath . "/src/config/session.php");
@@ -6,6 +12,7 @@ require_once($rootPath . "/src/config/connection.php");
require_once($rootPath . "/src/config/functions.php");
if (!isset($_SESSION['user_id'])) {
ob_end_clean();
die(json_encode(['status' => 'error', 'message' => 'User not logged in']));
}
@@ -53,21 +60,25 @@ if (isset($_POST['signature'])) {
$paymentStatus = checkMembershipPaymentStatus($user_id) ? 'PAID' : 'NOT_PAID';
// Respond with the appropriate redirect URL based on the payment status
ob_end_clean();
echo json_encode([
'status' => 'success',
'message' => 'Signature saved successfully!',
'paymentStatus' => $paymentStatus // Send payment status
]);
} else {
ob_end_clean();
echo json_encode(['status' => 'error', 'message' => 'Database update failed']);
}
$stmt->close();
$conn->close();
} else {
ob_end_clean();
echo json_encode(['status' => 'error', 'message' => 'Failed to save signature']);
}
} else {
ob_end_clean();
echo json_encode(['status' => 'error', 'message' => 'Signature not provided']);
}