![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/public_html/ |
<?php
/**
* Order Success / Thank You Page
* Shows confirmation after successful purchase of tracks, credits, or tickets
*/
session_start();
require_once 'config/database.php';
require_once 'includes/translations.php';
if (!isset($_SESSION['user_id'])) {
header('Location: /auth/login.php');
exit;
}
$pdo = getDBConnection();
$user = getUserById($_SESSION['user_id']);
// Get purchase type from URL or session
$purchase_type = $_GET['type'] ?? 'mixed'; // 'tracks', 'credits', 'tickets', 'mixed'
$payment_intent_id = $_GET['payment_intent'] ?? null;
// Try to get order details from session if available
$order_details = $_SESSION['last_payment_data']['order_details'] ?? null;
$cart_summary = $order_details['cart_summary'] ?? [];
// Determine purchase types from cart summary
$has_tracks = false;
$has_credits = false;
$has_tickets = false;
foreach ($cart_summary as $item) {
if (isset($item['type'])) {
if ($item['type'] === 'track') $has_tracks = true;
if ($item['type'] === 'credit') $has_credits = true;
if ($item['type'] === 'ticket') $has_tickets = true;
}
}
// Auto-detect purchase type if not specified
if ($purchase_type === 'mixed' && !empty($cart_summary)) {
if ($has_tracks && !$has_credits && !$has_tickets) {
$purchase_type = 'tracks';
} elseif ($has_credits && !$has_tracks && !$has_tickets) {
$purchase_type = 'credits';
} elseif ($has_tickets && !$has_tracks && !$has_credits) {
$purchase_type = 'tickets';
}
}
// Clear payment data from session after displaying
if (isset($_SESSION['last_payment_data'])) {
unset($_SESSION['last_payment_data']);
}
// Clear carts
if (isset($_SESSION['credit_cart'])) {
$_SESSION['credit_cart'] = [];
}
if (isset($_SESSION['cart'])) {
$_SESSION['cart'] = [];
}
if (isset($_SESSION['ticket_cart'])) {
$_SESSION['ticket_cart'] = [];
}
$page_title = t('checkout.order_success_title') ?? 'Order Confirmed!';
$current_page = 'order_success';
include 'includes/header.php';
?>
<style>
.order-success-container {
max-width: 800px;
margin: 3rem auto;
padding: 2rem;
}
.success-card {
background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
border-radius: 16px;
padding: 3rem;
text-align: center;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
border: 1px solid rgba(102, 126, 234, 0.2);
}
.success-icon {
font-size: 5rem;
color: #48bb78;
margin-bottom: 1.5rem;
animation: scaleIn 0.5s ease-out;
}
@keyframes scaleIn {
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.success-title {
color: #ffffff;
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
}
.success-message {
color: #a0aec0;
font-size: 1.2rem;
margin-bottom: 2rem;
line-height: 1.6;
}
.order-summary {
background: rgba(0, 0, 0, 0.3);
border-radius: 12px;
padding: 2rem;
margin: 2rem 0;
text-align: left;
}
.order-summary h3 {
color: #ffffff;
font-size: 1.3rem;
margin-bottom: 1.5rem;
text-align: center;
}
.order-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.order-item:last-child {
border-bottom: none;
}
.order-item-name {
color: #ffffff;
font-weight: 500;
}
.order-item-price {
color: #667eea;
font-weight: 600;
}
.order-total {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
margin-top: 1rem;
background: rgba(102, 126, 234, 0.1);
border-radius: 8px;
border-top: 2px solid #667eea;
}
.order-total-label {
color: #ffffff;
font-size: 1.2rem;
font-weight: 600;
}
.order-total-amount {
color: #667eea;
font-size: 1.5rem;
font-weight: 700;
}
.action-buttons {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
margin-top: 2.5rem;
}
.action-btn {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 14px 28px;
border-radius: 8px;
text-decoration: none;
font-weight: 600;
font-size: 1rem;
transition: all 0.3s ease;
border: none;
cursor: pointer;
}
.action-btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #ffffff;
}
.action-btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}
.action-btn-secondary {
background: rgba(255, 255, 255, 0.1);
color: #ffffff;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.action-btn-secondary:hover {
background: rgba(255, 255, 255, 0.15);
transform: translateY(-2px);
}
.quick-links {
margin-top: 2rem;
padding-top: 2rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.quick-links h4 {
color: #ffffff;
font-size: 1.1rem;
margin-bottom: 1rem;
text-align: center;
}
.quick-links-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-top: 1rem;
}
.quick-link {
display: block;
padding: 1rem;
background: rgba(0, 0, 0, 0.3);
border-radius: 8px;
text-decoration: none;
color: #a0aec0;
text-align: center;
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.05);
}
.quick-link:hover {
background: rgba(102, 126, 234, 0.1);
color: #667eea;
border-color: rgba(102, 126, 234, 0.3);
transform: translateY(-2px);
}
.quick-link i {
display: block;
font-size: 1.5rem;
margin-bottom: 0.5rem;
color: #667eea;
}
@media (max-width: 768px) {
.order-success-container {
padding: 1rem;
margin: 1rem auto;
}
.success-card {
padding: 2rem 1.5rem;
}
.success-title {
font-size: 2rem;
}
.action-buttons {
flex-direction: column;
}
.action-btn {
width: 100%;
justify-content: center;
}
}
</style>
<div class="order-success-container">
<div class="success-card">
<div class="success-icon">
<i class="fas fa-check-circle"></i>
</div>
<h1 class="success-title">
<?php if ($purchase_type === 'tracks'): ?>
<?= t('checkout.tracks_purchased_title') ?? 'Tracks Purchased!' ?>
<?php elseif ($purchase_type === 'credits'): ?>
<?= t('checkout.credits_purchased_title') ?? 'Credits Added!' ?>
<?php elseif ($purchase_type === 'tickets'): ?>
<?= t('checkout.tickets_purchased_title') ?? 'Tickets Confirmed!' ?>
<?php else: ?>
<?= t('checkout.order_success_title') ?? 'Order Confirmed!' ?>
<?php endif; ?>
</h1>
<p class="success-message">
<?php if ($purchase_type === 'tracks'): ?>
<?= t('checkout.tracks_purchased_message') ?? 'Thank you for your purchase! Your tracks are now available in your library.' ?>
<?php elseif ($purchase_type === 'credits'): ?>
<?= t('checkout.credits_purchased_message') ?? 'Thank you for your purchase! Your credits have been added to your account.' ?>
<?php elseif ($purchase_type === 'tickets'): ?>
<?= t('checkout.tickets_purchased_message') ?? 'Thank you for your purchase! Your event tickets are confirmed and ready to use.' ?>
<?php else: ?>
<?= t('checkout.order_success_message') ?? 'Thank you for your purchase! Your order has been processed successfully.' ?>
<?php endif; ?>
</p>
<?php if (!empty($cart_summary)): ?>
<div class="order-summary">
<h3><?= t('checkout.order_summary') ?? 'Order Summary' ?></h3>
<?php
$total_amount = 0;
foreach ($cart_summary as $item):
$item_amount = ($item['amount'] ?? 0) / 100; // Convert from cents
$total_amount += $item_amount;
?>
<div class="order-item">
<div class="order-item-name">
<?php if (isset($item['title'])): ?>
<?= htmlspecialchars($item['title']) ?>
<?php if (isset($item['artist'])): ?>
<span style="color: #a0aec0; font-size: 0.9rem;">by <?= htmlspecialchars($item['artist']) ?></span>
<?php endif; ?>
<?php elseif (isset($item['name'])): ?>
<?= htmlspecialchars($item['name']) ?>
<?php if (isset($item['credits'])): ?>
<span style="color: #a0aec0; font-size: 0.9rem;">(<?= $item['credits'] ?> credits)</span>
<?php endif; ?>
<?php elseif (isset($item['event_title'])): ?>
<?= htmlspecialchars($item['event_title']) ?>
<?php else: ?>
<?= htmlspecialchars($item['type'] ?? 'Item') ?>
<?php endif; ?>
<?php if (isset($item['quantity']) && $item['quantity'] > 1): ?>
<span style="color: #a0aec0; font-size: 0.9rem;">× <?= $item['quantity'] ?></span>
<?php endif; ?>
</div>
<div class="order-item-price">
$<?= number_format($item_amount, 2) ?>
</div>
</div>
<?php endforeach; ?>
<div class="order-total">
<span class="order-total-label"><?= t('checkout.total') ?? 'Total' ?></span>
<span class="order-total-amount">$<?= number_format($total_amount, 2) ?></span>
</div>
</div>
<?php endif; ?>
<div class="action-buttons">
<?php if ($has_tracks): ?>
<a href="/my_purchases.php" class="action-btn action-btn-primary">
<i class="fas fa-music"></i>
<?= t('checkout.view_purchases') ?? 'View My Purchases' ?>
</a>
<?php endif; ?>
<?php if ($has_credits): ?>
<a href="/credits.php" class="action-btn action-btn-primary">
<i class="fas fa-coins"></i>
<?= t('checkout.view_credits') ?? 'View Credits' ?>
</a>
<?php endif; ?>
<?php if ($has_tickets): ?>
<a href="/account_settings.php?tab=tickets" class="action-btn action-btn-primary">
<i class="fas fa-ticket-alt"></i>
<?= t('checkout.view_tickets') ?? 'View My Tickets' ?>
</a>
<?php endif; ?>
<a href="/invoices.php<?= $payment_intent_id ? '?payment_intent=' . urlencode($payment_intent_id) : '' ?>" class="action-btn action-btn-secondary">
<i class="fas fa-file-invoice"></i>
<?= t('checkout.view_invoice') ?? 'View Invoice' ?>
</a>
</div>
<div class="quick-links">
<h4><?= t('checkout.quick_links') ?? 'Quick Links' ?></h4>
<div class="quick-links-grid">
<a href="/my_purchases.php" class="quick-link">
<i class="fas fa-shopping-bag"></i>
<span><?= t('checkout.my_purchases') ?? 'My Purchases' ?></span>
</a>
<a href="/invoices.php" class="quick-link">
<i class="fas fa-file-invoice-dollar"></i>
<span><?= t('checkout.invoices') ?? 'Invoices' ?></span>
</a>
<a href="/account_settings.php" class="quick-link">
<i class="fas fa-user-cog"></i>
<span><?= t('checkout.account_settings') ?? 'Account Settings' ?></span>
</a>
<a href="/index.php#create" class="quick-link">
<i class="fas fa-plus-circle"></i>
<span><?= t('checkout.create_music') ?? 'Create Music' ?></span>
</a>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>