0) { $stmt = $pdo->prepare(" INSERT INTO survey_responses (user_id, project_id, status, transaction_id, response_date, ip_address, user_agent) VALUES (?, ?, ?, ?, NOW(), ?, ?) ON DUPLICATE KEY UPDATE status = VALUES(status), response_date = NOW() "); $stmt->execute([ $user_id, $project_id, $status, $transaction_id, $_SERVER['REMOTE_ADDR'] ?? '', $_SERVER['HTTP_USER_AGENT'] ?? '' ]); } } } } catch (Exception $e) { error_log("Redirect logging error: " . $e->getMessage()); // Continue anyway - logging is optional } // Load the appropriate landing page $page_file = __DIR__ . '/pages/' . $status . '.php'; if (file_exists($page_file)) { // Set variables for the landing page $current_project_id = $project_id; $current_status = $status; $current_user_id = $user_id; include $page_file; } else { // Fallback if page doesn't exist echo "
Your response has been recorded.
"; }