<?php
// Start session
session_start();
// Enable basic error logging
ini_set('log_errors', 1);
ini_set('error_log', 'C:/xampp/logs/php_error.log');
// Process the POST data
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Get the payment plan and order ID from POST data
$plan = isset($_POST['plan']) ? $_POST['plan'] : 'full';
$order_id = isset($_POST['order_id']) ? $_POST['order_id'] : '';
// Store in session
$_SESSION['payment_plan_data'] = [
'plan' => $plan,
'order_id' => $order_id,
'timestamp' => time()
];
// Log
error_log("Payment plan stored in session: Plan=$plan, Order ID=$order_id");
// Return success response
header('Content-Type: application/json');
echo json_encode(['success' => true]);
exit;
}
// If not a POST request, return error
header('Content-Type: application/json');
echo json_encode(['success' => false, 'error' => 'Invalid request method']);
?>