prepare($sql); $stmt->execute([$payment_status, $payment_return]); } } } // Redirect to clean URL header("Location: ?page=softwaretool&payment_return=1&order_id={$payment_return}"); exit; } catch (Exception $e) { if (debug) { debuglog("PayPal Capture Error: " . $e->getMessage()); } } } template_header('Softwaretool', 'softwaretool','view'); // Show payment return message if returning from payment $view = ''; $payment_modal = ''; if ($payment_return && $payment_return_status) { // Check actual payment status in database $pdo = dbConnect($dbname); $sql = 'SELECT payment_status FROM transactions WHERE txn_id = ?'; $stmt = $pdo->prepare($sql); $stmt->execute([$payment_return]); $transaction = $stmt->fetch(PDO::FETCH_ASSOC); if ($transaction) { if ($transaction['payment_status'] == 1) { // Payment confirmed as paid $payment_modal = ' '; } else if ($transaction['payment_status'] == 0 || $transaction['payment_status'] == 101) { // Payment pending $payment_modal = ' '; } else { // Payment failed/cancelled $payment_modal = ' '; } } } $view .= '

'.$softwaretool_h2 .'

'.$softwaretool_p.'

'; if (isset($_GET['equipmentID'])){$returnpage = 'equipment&equipmentID='.$_GET['equipmentID']; } else {$returnpage = 'dashboard';} //SHOW BACK BUTTON ONLY FOR PORTAL USERS if (isAllowed('dashboard',$_SESSION['profile'],$_SESSION['permission'],'R') != 0){ $view .= '
'; } $view .= '
'; $view .= '
'; $view .= ' '; $view .= ''; //OUTPUT echo $view; // Output payment modal if exists echo $payment_modal; echo ' '; template_footer(); ?>