T.ME/BIBIL_0DAY
CasperSecurity


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/add_to_cart.php
<?php
session_start();
require_once 'utils/subscription_helpers.php';
require_once 'includes/translations.php';

$data = json_decode(file_get_contents('php://input'), true);

// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
    echo json_encode([
        'success' => false, 
        'error' => t('common.login_required', ['default' => 'Please log in to add items to cart']),
        'requires_login' => true
    ]);
    exit;
}

if (!isset($_SESSION['credit_cart'])) {
    $_SESSION['credit_cart'] = [];
}

if ($data['type'] === 'track') {
    // Music tracks should be handled by cart.php, not add_to_cart.php
    // This endpoint is only for credit packages
    error_log("add_to_cart.php: Track type not supported here - use cart.php instead");
    echo json_encode(['success' => false, 'error' => 'Tracks should be added via cart.php']);
    exit;
}

if ($data['type'] === 'credit') {
    // IMPORTANT: Credit purchases require active subscription (minimum Essential $5/month)
    $has_active_subscription = hasActiveSubscription($_SESSION['user_id']);
    if ($has_active_subscription === false) {
        error_log("add_to_cart.php: User " . $_SESSION['user_id'] . " attempted to add credits to cart without active subscription");
        echo json_encode([
            'success' => false, 
            'error' => t('checkout.subscription_required_error'),
            'message' => t('checkout.subscription_required_message'),
            'requires_subscription' => true,
            'subscription_url' => '/account_settings.php?tab=subscription'
        ]);
        exit;
    }
    // Check if this credit package is already in the cart
    $found = false;
    foreach ($_SESSION['credit_cart'] as &$item) {
        if ($item['type'] === 'credit' && $item['package'] == $data['package']) {
            $item['quantity'] += 1;
            $found = true;
            break;
        }
    }
    unset($item);
    if (!$found) {
        $_SESSION['credit_cart'][] = [
            'type'    => 'credit',
            'package' => $data['package'],
            'credits' => $data['credits'],
            'price'   => $data['price'],
            'quantity'=> $data['quantity'] ?? 1
        ];
    }
    echo json_encode(['success' => true]);
    exit;
}

echo json_encode(['success' => false, 'error' => 'Invalid item type']); 

CasperSecurity Mini