Compare commits
4 Commits
0c068eeb69
...
5f1a6bc441
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f1a6bc441 | ||
|
|
716de2f0e9 | ||
|
|
79e292dc7c | ||
|
|
59c1e37d5c |
BIN
assets/images/pp/2f40af86bfbe04a5c83bbb6cdf1c1e6b.png
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
assets/images/pp/424b31c09e1543a922deb690bfbb57c8.png
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
assets/images/pp/4b8bd95296e082031c8ae8c4b35fed88.png
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
assets/images/pp/5f9036058b40b2c23052d8226711ac5c.png
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
assets/images/pp/8bc567fbcdffcf5823845740a54d5e6d.jpg
Normal file
|
After Width: | Height: | Size: 170 KiB |
BIN
assets/images/pp/9a1f344bc68815fa15bb0a1e16017ee6.png
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
assets/images/pp/b8d7fa81c1ab3e67dc86441b09d927cd.jpg
Normal file
|
After Width: | Height: | Size: 170 KiB |
BIN
assets/images/pp/cc83c3045d2b41073f0939f298d06459.jpg
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/images/pp/e607963d306a19d1df94c50d577ea439.jpg
Normal file
|
After Width: | Height: | Size: 290 KiB |
@@ -168,24 +168,22 @@ $user = $result->fetch_assoc();
|
|||||||
data: formData,
|
data: formData,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// Parse response if needed
|
|
||||||
if (typeof response === "string") {
|
|
||||||
response = JSON.parse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.status === 'success') {
|
if (response.status === 'success') {
|
||||||
// Update the profile picture source with cache-busting query string
|
|
||||||
// Reload the current page
|
|
||||||
window.location.reload();
|
|
||||||
|
|
||||||
$('#responseMessage').html('<div class="alert alert-success">' + response.message + '</div>');
|
$('#responseMessage').html('<div class="alert alert-success">' + response.message + '</div>');
|
||||||
|
// Reload the current page after a short delay
|
||||||
|
setTimeout(function() {
|
||||||
|
window.location.reload();
|
||||||
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
$('#responseMessage').html('<div class="alert alert-danger">' + response.message + '</div>');
|
$('#responseMessage').html('<div class="alert alert-danger">' + response.message + '</div>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function(xhr, status, error) {
|
||||||
$('#responseMessage').html('<div class="alert alert-danger">Error uploading profile picture.</div>');
|
console.log('AJAX Error:', status, error);
|
||||||
|
console.log('Response Text:', xhr.responseText);
|
||||||
|
$('#responseMessage').html('<div class="alert alert-danger">Error uploading profile picture: ' + error + '</div>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
<?php
|
<?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__));
|
$rootPath = dirname(dirname(__DIR__));
|
||||||
require_once($rootPath . "/src/config/env.php");
|
require_once($rootPath . "/src/config/env.php");
|
||||||
require_once($rootPath . "/src/config/session.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");
|
require_once($rootPath . "/src/config/functions.php");
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
ob_end_clean();
|
||||||
die(json_encode(['status' => 'error', 'message' => 'User not logged in']));
|
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';
|
$paymentStatus = checkMembershipPaymentStatus($user_id) ? 'PAID' : 'NOT_PAID';
|
||||||
|
|
||||||
// Respond with the appropriate redirect URL based on the payment status
|
// Respond with the appropriate redirect URL based on the payment status
|
||||||
|
ob_end_clean();
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Signature saved successfully!',
|
'message' => 'Signature saved successfully!',
|
||||||
'paymentStatus' => $paymentStatus // Send payment status
|
'paymentStatus' => $paymentStatus // Send payment status
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
ob_end_clean();
|
||||||
echo json_encode(['status' => 'error', 'message' => 'Database update failed']);
|
echo json_encode(['status' => 'error', 'message' => 'Database update failed']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
$conn->close();
|
$conn->close();
|
||||||
} else {
|
} else {
|
||||||
|
ob_end_clean();
|
||||||
echo json_encode(['status' => 'error', 'message' => 'Failed to save signature']);
|
echo json_encode(['status' => 'error', 'message' => 'Failed to save signature']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
ob_end_clean();
|
||||||
echo json_encode(['status' => 'error', 'message' => 'Signature not provided']);
|
echo json_encode(['status' => 'error', 'message' => 'Signature not provided']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
ob_start(); // Start output buffering to allow headers before output
|
||||||
$headerStyle = 'light';
|
$headerStyle = 'light';
|
||||||
$rootPath = dirname(dirname(__DIR__));
|
$rootPath = dirname(dirname(__DIR__));
|
||||||
include_once($rootPath . '/header.php');
|
require_once($rootPath . "/src/config/env.php");
|
||||||
|
require_once($rootPath . "/src/config/session.php");
|
||||||
|
include_once($rootPath . '/src/config/connection.php');
|
||||||
require_once($rootPath . "/src/config/functions.php");
|
require_once($rootPath . "/src/config/functions.php");
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
@@ -11,7 +14,8 @@ if (!$user_id) {
|
|||||||
die("Not logged in.");
|
die("Not logged in.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle POST submission
|
// Handle POST submission BEFORE including header
|
||||||
|
$redirect_url = null;
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
// CSRF Token Validation
|
// CSRF Token Validation
|
||||||
if (!isset($_POST['csrf_token']) || !validateCSRFToken($_POST['csrf_token'])) {
|
if (!isset($_POST['csrf_token']) || !validateCSRFToken($_POST['csrf_token'])) {
|
||||||
@@ -35,8 +39,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$target_dir = $rootPath . "/src/processors/uploads/pop/";
|
$target_dir = $rootPath . "/src/processors/uploads/pop/";
|
||||||
$randomFilename = $validationResult['filename'];
|
// Use EFT ID as filename instead of random filename
|
||||||
$target_file = $target_dir . $randomFilename;
|
$filename = $eft_id . '.pdf';
|
||||||
|
$target_file = $target_dir . $filename;
|
||||||
|
|
||||||
// Make sure target directory exists and writable
|
// Make sure target directory exists and writable
|
||||||
if (!is_dir($target_dir)) {
|
if (!is_dir($target_dir)) {
|
||||||
@@ -91,15 +96,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$description = "Payment";
|
$description = "Payment";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendPOP($fullname, $randomFilename, $amount, $description)) {
|
if (sendPOP($fullname, $filename, $amount, $description)) {
|
||||||
$_SESSION['message'] = "Thank you! Your payment proof has been uploaded and notification sent.";
|
$_SESSION['message'] = "Thank you! Your payment proof has been uploaded and notification sent.";
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['message'] = "Payment uploaded, but notification email could not be sent.";
|
$_SESSION['message'] = "Payment uploaded, but notification email could not be sent.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the action
|
// Log the action
|
||||||
auditLog($user_id, 'POP_UPLOAD', 'efts', $eft_id, ['filename' => $randomFilename, 'payment_type' => $payment_type]);
|
auditLog($user_id, 'POP_UPLOAD', 'efts', $eft_id, ['filename' => $filename, 'payment_type' => $payment_type]);
|
||||||
|
|
||||||
|
$redirect_url = 'bookings';
|
||||||
|
ob_end_clean();
|
||||||
header("Location: bookings");
|
header("Location: bookings");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@@ -109,6 +116,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now that POST is handled, include header for display
|
||||||
|
include_once($rootPath . '/header.php');
|
||||||
|
|
||||||
// Fetch bookings for dropdown
|
// Fetch bookings for dropdown
|
||||||
$stmt = $conn->prepare("
|
$stmt = $conn->prepare("
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
ob_start(); // Start output buffering
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
// Set JSON response header BEFORE any other output
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
$rootPath = dirname(dirname(__DIR__));
|
$rootPath = dirname(dirname(__DIR__));
|
||||||
|
require_once($rootPath . "/src/config/env.php");
|
||||||
|
require_once($rootPath . "/src/config/session.php");
|
||||||
include_once($rootPath . '/src/config/connection.php');
|
include_once($rootPath . '/src/config/connection.php');
|
||||||
require_once($rootPath . "/src/config/functions.php");
|
require_once($rootPath . "/src/config/functions.php");
|
||||||
require_once($rootPath . "/src/config/env.php");
|
|
||||||
|
// Check database connection
|
||||||
|
if (!isset($conn) || $conn === null) {
|
||||||
|
die(json_encode(['status' => 'error', 'message' => 'Database connection failed']));
|
||||||
|
}
|
||||||
|
|
||||||
$response = array('status' => 'error', 'message' => 'Something went wrong');
|
$response = array('status' => 'error', 'message' => 'Something went wrong');
|
||||||
|
|
||||||
@@ -69,16 +80,18 @@ if (isset($_FILES['profile_picture']) && $_FILES['profile_picture']['error'] !=
|
|||||||
// Log the action
|
// Log the action
|
||||||
auditLog($user_id, 'PROFILE_PIC_UPLOAD', 'users', $user_id, ['filename' => $randomFilename]);
|
auditLog($user_id, 'PROFILE_PIC_UPLOAD', 'users', $user_id, ['filename' => $randomFilename]);
|
||||||
} else {
|
} else {
|
||||||
$response['message'] = 'Failed to update profile picture in the database';
|
$response['message'] = 'Failed to update profile picture in the database: ' . $stmt->error;
|
||||||
}
|
}
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
} else {
|
} else {
|
||||||
$response['message'] = 'Failed to move uploaded file.';
|
$response['message'] = 'Failed to move uploaded file. Error code: ' . $_FILES['profile_picture']['error'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$response['message'] = 'No file uploaded or file error.';
|
$response['message'] = 'No file uploaded or file error.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean output buffer and send only JSON
|
||||||
|
ob_end_clean();
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||