![]() 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
/**
* Unified Pricing Page
* Shows all subscription tiers in one place
*/
session_start();
require_once 'config/database.php';
require_once __DIR__ . '/includes/translations.php';
$plans_config = require __DIR__ . '/config/subscription_plans.php';
// Get user info if logged in
$user = null;
$existing_subscription = null;
if (isset($_SESSION['user_id'])) {
$pdo = getDBConnection();
$stmt = $pdo->prepare("SELECT id, name, email, plan FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
require_once __DIR__ . '/utils/subscription_helpers.php';
// Use unified function to get effective plan
$effective_plan = getEffectivePlan($_SESSION['user_id']);
// Get subscription info for display
$subscription_info = getEffectiveSubscription($_SESSION['user_id']);
// Only show as "current plan" if user has an active subscription or valid plan
if ($effective_plan !== 'free' && $subscription_info) {
// Use effective plan from subscription
$existing_subscription = [
'plan_name' => $effective_plan,
'status' => $subscription_info['status'] ?? 'active'
];
} elseif ($effective_plan !== 'free') {
// User has a plan set but no subscription record (shouldn't happen, but handle gracefully)
$existing_subscription = [
'plan_name' => $effective_plan,
'status' => 'active'
];
}
}
/**
* Translate a plan feature string
*/
function translateFeature($feature) {
// Extract number from "X tracks per month" format
if (preg_match('/^(\d+)\s+tracks\s+per\s+month$/i', $feature, $matches)) {
return t('plan.feature.tracks_per_month', ['count' => $matches[1]]);
}
// Map exact feature strings to translation keys
$featureMap = [
'Monthly reset' => 'plan.feature.monthly_reset',
'Basic AI models' => 'plan.feature.basic_ai_models',
'Advanced AI models' => 'plan.feature.advanced_ai_models',
'Standard generation speed' => 'plan.feature.standard_speed',
'High-speed generation' => 'plan.feature.high_speed',
'Priority queue access' => 'plan.feature.priority_queue',
'Highest priority queue' => 'plan.feature.highest_priority',
'Personal use license' => 'plan.feature.personal_license',
'Commercial use license' => 'plan.feature.commercial_license',
'Unlimited downloads' => 'plan.feature.unlimited_downloads',
'API access' => 'plan.feature.api_access',
'Full API access' => 'plan.feature.full_api_access',
'Dedicated support' => 'plan.feature.dedicated_support',
'White-label options' => 'plan.feature.white_label',
'Dedicated account manager' => 'plan.feature.account_manager',
'Custom integrations' => 'plan.feature.custom_integrations',
'SLA guarantee' => 'plan.feature.sla_guarantee',
'Cancel anytime' => 'plan.feature.cancel_anytime',
];
// Return translated feature if mapping exists, otherwise return original
if (isset($featureMap[$feature])) {
return t($featureMap[$feature]);
}
// Fallback to original if no translation found
return $feature;
}
$page_title = t('pricing.page_title');
include 'includes/header.php';
?>
<style>
.pricing-hero {
text-align: center;
padding: 60px 20px;
background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
margin-bottom: 60px;
}
.pricing-hero h1 {
font-size: 3.5rem;
color: white;
margin-bottom: 20px;
}
.pricing-hero p {
font-size: 1.3rem;
color: #a0aec0;
max-width: 600px;
margin: 0 auto;
}
.pricing-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 30px;
max-width: 1400px;
margin: 0 auto;
padding: 0 20px 60px;
}
.pricing-card {
background: #2a2a2a;
border-radius: 16px;
padding: 40px 30px;
text-align: center;
position: relative;
transition: transform 0.3s, box-shadow 0.3s;
border: 2px solid transparent;
}
.pricing-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 40px rgba(102, 126, 234, 0.2);
}
.pricing-card.featured {
border-color: #667eea;
transform: scale(1.05);
}
.pricing-card.featured .most-popular-badge {
position: absolute;
top: -12px;
left: 50%;
transform: translateX(-50%);
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
padding: 5px 20px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 600;
z-index: 1;
}
.plan-icon {
font-size: 3rem;
margin-bottom: 20px;
}
.plan-name {
font-size: 2rem;
color: white;
font-weight: bold;
margin-bottom: 10px;
}
.plan-price {
font-size: 3.5rem;
font-weight: 800;
margin-bottom: 5px;
}
.plan-period {
color: #a0aec0;
font-size: 1.1rem;
margin-bottom: 30px;
}
.plan-tracks {
background: rgba(102, 126, 234, 0.1);
padding: 15px;
border-radius: 10px;
margin-bottom: 30px;
font-size: 1.3rem;
color: #667eea;
font-weight: 600;
}
.plan-features {
list-style: none;
padding: 0;
margin-bottom: 30px;
text-align: left;
}
.plan-features li {
color: #a0aec0;
padding: 10px 0;
border-bottom: 1px solid #333;
font-size: 1rem;
}
.plan-features li:last-child {
border-bottom: none;
}
.plan-features li::before {
content: '✅ ';
margin-right: 10px;
}
.subscribe-btn {
width: 100%;
padding: 15px;
border: none;
border-radius: 10px;
font-size: 1.2rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
text-decoration: none;
display: block;
text-align: center;
}
.subscribe-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}
.current-plan-badge {
background: #2d5016;
color: #48bb78;
padding: 10px 20px;
border-radius: 8px;
font-weight: 600;
margin-bottom: 20px;
display: inline-block;
}
.extra-credits-section {
max-width: 1200px;
margin: 60px auto;
padding: 40px;
background: #2a2a2a;
border-radius: 16px;
text-align: center;
}
.extra-credits-section h2 {
color: white;
font-size: 2.5rem;
margin-bottom: 20px;
}
.extra-credits-section p {
color: #a0aec0;
font-size: 1.2rem;
margin-bottom: 30px;
}
.credits-btn {
display: inline-block;
padding: 15px 40px;
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
text-decoration: none;
border-radius: 10px;
font-size: 1.2rem;
font-weight: 600;
transition: all 0.3s;
}
.credits-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}
/* Mobile Responsive Styles */
@media (max-width: 768px) {
.pricing-hero {
padding: 40px 15px;
margin-bottom: 40px;
}
.pricing-hero h1 {
font-size: 2.5rem;
margin-bottom: 15px;
}
.pricing-hero p {
font-size: 1.1rem;
}
.pricing-grid {
grid-template-columns: 1fr;
gap: 25px;
padding: 0 15px 40px;
}
.pricing-card {
padding: 30px 20px;
}
.pricing-card.featured {
transform: scale(1);
}
.plan-icon {
font-size: 2.5rem;
margin-bottom: 15px;
}
.plan-name {
font-size: 1.6rem;
}
.plan-price {
font-size: 2.8rem;
}
.plan-period {
font-size: 1rem;
margin-bottom: 25px;
}
.plan-tracks {
padding: 12px;
font-size: 1.1rem;
margin-bottom: 25px;
}
.plan-features {
margin-bottom: 25px;
}
.plan-features li {
padding: 8px 0;
font-size: 0.95rem;
}
.subscribe-btn {
padding: 14px;
font-size: 1.1rem;
min-height: 44px;
}
.extra-credits-section {
margin: 40px auto;
padding: 30px 20px;
}
.extra-credits-section h2 {
font-size: 2rem;
margin-bottom: 15px;
}
.extra-credits-section p {
font-size: 1.1rem;
margin-bottom: 25px;
}
.credits-btn {
padding: 14px 30px;
font-size: 1.1rem;
min-height: 44px;
}
}
@media (max-width: 480px) {
.pricing-hero {
padding: 30px 12px;
margin-bottom: 30px;
}
.pricing-hero h1 {
font-size: 2rem;
}
.pricing-hero p {
font-size: 1rem;
}
.pricing-grid {
gap: 20px;
padding: 0 12px 30px;
}
.pricing-card {
padding: 25px 15px;
}
.plan-icon {
font-size: 2.2rem;
}
.plan-name {
font-size: 1.4rem;
}
.plan-price {
font-size: 2.4rem;
}
.plan-tracks {
font-size: 1rem;
padding: 10px;
}
.plan-features li {
font-size: 0.9rem;
padding: 6px 0;
}
.subscribe-btn {
padding: 12px;
font-size: 1rem;
}
.extra-credits-section {
padding: 25px 15px;
}
.extra-credits-section h2 {
font-size: 1.75rem;
}
.extra-credits-section p {
font-size: 1rem;
}
.credits-btn {
padding: 12px 25px;
font-size: 1rem;
}
}
</style>
<div class="pricing-hero">
<h1><?= t('pricing.hero_title') ?></h1>
<p><?= t('pricing.hero_subtitle') ?></p>
</div>
<div class="pricing-grid">
<?php
// Add free plan at the beginning
$plan_order = ['free', 'essential', 'starter', 'pro', 'premium', 'enterprise'];
foreach ($plan_order as $index => $plan_key):
// Handle free plan (not in plans_config)
if ($plan_key === 'free') {
$plan = [
'name' => 'Free',
'price' => 0.00,
'tracks_per_month' => 0,
'features' => [
'Purchase tracks from artists',
'Purchase event tickets',
'Access all platform features',
'Basic AI models',
'Personal use license',
'Credit-based system'
],
'target_audience' => 'Free users',
'icon' => 'fa-gift',
'color' => '#9ca3af'
];
$plan_display_name = getPlanLabel('free', 'Free');
} else {
$plan = $plans_config[$plan_key];
$plan_display_name = getPlanLabel($plan_key, $plan['name']);
}
$is_featured = $plan_key === 'pro'; // Pro is featured
$is_current = ($existing_subscription && $existing_subscription['plan_name'] === $plan_key) || (!$existing_subscription && $plan_key === 'free' && (!isset($user['plan']) || $user['plan'] === 'free'));
?>
<div class="pricing-card <?= $is_featured ? 'featured' : '' ?>">
<?php if ($is_featured): ?>
<div class="most-popular-badge"><?= t('pricing.most_popular') ?></div>
<?php endif; ?>
<div class="plan-icon" style="color: <?= $plan['color'] ?>;">
<i class="fas <?= $plan['icon'] ?>"></i>
</div>
<div class="plan-name"><?= htmlspecialchars($plan_display_name) ?></div>
<div class="plan-price" style="color: <?= $plan['color'] ?>;">
<?php if ($plan_key === 'free'): ?>
<?= t('pricing.free', ['default' => 'Free']) ?>
<?php else: ?>
$<?= number_format($plan['price'], 2) ?>
<?php endif; ?>
</div>
<?php if ($plan_key !== 'free'): ?>
<div class="plan-period"><?= t('pricing.per_month') ?></div>
<?php endif; ?>
<div class="plan-tracks">
<?php if ($plan_key === 'free'): ?>
<?= t('pricing.credit_based', ['default' => 'Credit-Based']) ?>
<?php else: ?>
<?= $plan['tracks_per_month'] ?> <?= t('pricing.tracks_per_month') ?>
<?php endif; ?>
</div>
<?php if ($is_current): ?>
<div class="current-plan-badge"><?= t('pricing.current_plan') ?></div>
<?php endif; ?>
<ul class="plan-features">
<?php foreach ($plan['features'] as $feature): ?>
<li><?= htmlspecialchars(translateFeature($feature)) ?></li>
<?php endforeach; ?>
</ul>
<?php if ($plan_key === 'free'): ?>
<?php if ($is_current): ?>
<div class="current-plan-badge"><?= t('pricing.current_plan') ?></div>
<a href="/credits.php" class="subscribe-btn" style="background: <?= $plan['color'] ?>;">
<i class="fas fa-shopping-cart" style="margin-right: 8px;"></i>
<?= t('pricing.view_credit_packages', ['default' => 'View Credit Packages']) ?>
</a>
<?php elseif ($existing_subscription): ?>
<a href="/subscribe.php?plan=free" class="subscribe-btn" style="background: linear-gradient(135deg, #e53e3e, #c53030);">
<i class="fas fa-times-circle" style="margin-right: 8px;"></i>
<?= t('pricing.switch_to_free', ['default' => 'Switch to Free Plan']) ?>
</a>
<?php else: ?>
<a href="/credits.php" class="subscribe-btn" style="background: <?= $plan['color'] ?>;">
<i class="fas fa-gift" style="margin-right: 8px;"></i>
<?= t('pricing.view_credit_packages', ['default' => 'View Credit Packages']) ?>
</a>
<?php endif; ?>
<?php elseif ($is_current): ?>
<a href="/manage_subscription.php" class="subscribe-btn" style="background: #48bb78;">
<?= t('pricing.manage_subscription') ?>
</a>
<?php elseif ($existing_subscription): ?>
<a href="/subscribe.php?plan=<?= $plan_key ?>" class="subscribe-btn" style="background: <?= $plan['color'] ?>;">
<?= t('pricing.switch_to', ['plan' => htmlspecialchars($plan_display_name)]) ?>
</a>
<?php else: ?>
<a href="/subscribe.php?plan=<?= $plan_key ?>" class="subscribe-btn" style="background: <?= $plan['color'] ?>;">
<?= t('pricing.subscribe_now') ?>
</a>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="extra-credits-section">
<h2><?= t('pricing.need_more_tracks') ?></h2>
<p><?= t('pricing.extra_credits_desc') ?></p>
<a href="/credits.php#extra-credits" class="credits-btn">
<i class="fas fa-coins"></i> <?= t('pricing.buy_extra_credits') ?>
</a>
</div>
<?php include 'includes/footer.php'; ?>