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/admin_includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/admin_includes/payment.php
<?php
// Payment Tab
// This file handles payment processor management

// Payment processors configuration
$payment_processors = [
    'stripe' => [
        'name' => 'Stripe',
        'status' => 'active',
        'api_key' => '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',
        'api_secret' => 'pk_live_51Rn8TtD0zXLMB4gHMCZ5OMunyo0YtN6hBR30BoXFEiQxPG9I6U2tko6Axxwl0yJS21DCCykhC9PxAMdZoEfwJI0p00KlrZUR3w',
        'webhook_url' => 'https://soundstudiopro.com/webhooks/stripe',
        'last_tested' => '2025-07-24 21:45:00',
        'icon' => 'fab fa-stripe',
        'mode' => 'live'
    ],
    'paypal' => [
        'name' => 'PayPal',
        'status' => 'active',
        'api_key' => 'paypal-client-id-345',
        'api_secret' => 'paypal-secret-678',
        'webhook_url' => 'https://soundstudiopro.com/webhooks/paypal',
        'last_tested' => '2024-01-13 12:45:00',
        'icon' => 'fab fa-paypal'
    ],
    'square' => [
        'name' => 'Square',
        'status' => 'inactive',
        'api_key' => 'square-access-token-123',
        'api_secret' => 'square-application-secret-456',
        'webhook_url' => 'https://soundstudiopro.com/webhooks/square',
        'last_tested' => '2024-01-10 09:30:00',
        'icon' => 'fas fa-square'
    ],
    'braintree' => [
        'name' => 'Braintree',
        'status' => 'inactive',
        'api_key' => 'braintree-merchant-id-789',
        'api_secret' => 'braintree-private-key-012',
        'webhook_url' => 'https://soundstudiopro.com/webhooks/braintree',
        'last_tested' => '2024-01-08 14:15:00',
        'icon' => 'fas fa-credit-card'
    ]
];

// Payment statistics
$payment_stats = [
    'total_transactions' => 1247,
    'total_revenue' => 45678.90,
    'successful_payments' => 1198,
    'failed_payments' => 49,
    'average_transaction' => 36.67
];
?>

<!-- Payment Processors -->
<div class="section-header">
    <h2><i class="fas fa-credit-card"></i> Payment Processors</h2>
    <p>Configure payment gateways for your music platform.</p>
</div>

<!-- Payment Statistics -->
<div class="stats-grid" style="margin-bottom: 3rem;">
    <div class="stat-card">
        <div class="stat-number"><?= number_format($payment_stats['total_transactions']) ?></div>
        <div class="stat-label">Total Transactions</div>
    </div>
    <div class="stat-card">
        <div class="stat-number">$<?= number_format($payment_stats['total_revenue'], 2) ?></div>
        <div class="stat-label">Total Revenue</div>
    </div>
    <div class="stat-card">
        <div class="stat-number"><?= number_format($payment_stats['successful_payments']) ?></div>
        <div class="stat-label">Successful Payments</div>
    </div>
    <div class="stat-card">
        <div class="stat-number"><?= round(($payment_stats['successful_payments'] / $payment_stats['total_transactions']) * 100, 1) ?>%</div>
        <div class="stat-label">Success Rate</div>
    </div>
</div>

<div class="api-grid" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem;">
    <?php foreach ($payment_processors as $provider => $config): ?>
    <div class="api-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
        <div class="api-header" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem;">
            <div class="api-name" style="font-size: 1.6rem; font-weight: 600; color: white;">
                <i class="<?= $config['icon'] ?>"></i>
                <?= $config['name'] ?>
                <?php if (isset($config['mode']) && $config['mode'] === 'live'): ?>
                    <span style="background: #e53e3e; color: white; padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 1rem; margin-left: 0.5rem;">LIVE</span>
                <?php endif; ?>
            </div>
            <div class="api-status <?= $config['status'] ?>" style="padding: 0.5rem 1rem; border-radius: 20px; font-size: 1.2rem; font-weight: 600; color: white; background: <?= $config['status'] === 'active' ? '#48bb78' : '#e53e3e' ?>;"><?= ucfirst($config['status']) ?></div>
        </div>
        
        <form class="api-form" onsubmit="savePaymentConfig('<?= $provider ?>')">
            <div class="form-group" style="margin-bottom: 1rem;">
                <label style="display: block; color: #a0aec0; margin-bottom: 0.5rem; font-weight: 600;">API Key</label>
                <input type="text" name="api_key" value="<?= $config['api_key'] ?>" placeholder="Enter API Key" style="width: 100%; padding: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: white;">
            </div>
            
            <div class="form-group" style="margin-bottom: 1.5rem;">
                <label style="display: block; color: #a0aec0; margin-bottom: 0.5rem; font-weight: 600;">API Secret</label>
                <input type="password" name="api_secret" value="<?= $config['api_secret'] ?>" placeholder="Enter API Secret" style="width: 100%; padding: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: white;">
            </div>
            
            <div class="api-actions" style="display: flex; gap: 0.5rem; margin-bottom: 1.5rem;">
                <button type="submit" class="btn btn-primary" style="flex: 1;">
                    <i class="fas fa-save"></i>
                    Save Configuration
                </button>
                <button type="button" class="btn btn-secondary" onclick="testPaymentApi('<?= $provider ?>')" style="flex: 1;">
                    <i class="fas fa-vial"></i>
                    Test Connection
                </button>
                <button type="button" class="btn <?= $config['status'] === 'active' ? 'btn-danger' : 'btn-success' ?>" onclick="togglePaymentApi('<?= $provider ?>', '<?= $config['status'] ?>')" style="flex: 1;">
                    <i class="fas="<?= $config['status'] === 'active' ? 'fa-pause' : 'fa-play' ?>"></i>
                    <?= $config['status'] === 'active' ? 'Disable' : 'Enable' ?>
                </button>
            </div>
        </form>
        
        <div class="api-info" style="margin-bottom: 1.5rem;">
            <div class="info-item" style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
                <span class="info-label" style="color: #a0aec0;">Webhook URL:</span>
                <span class="info-value" style="color: white; font-family: monospace;"><?= $config['webhook_url'] ?></span>
            </div>
            <div class="info-item" style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
                <span class="info-label" style="color: #a0aec0;">Last Tested:</span>
                <span class="info-value" style="color: white;"><?= $config['last_tested'] ?></span>
            </div>
            <?php if ($provider === 'stripe'): ?>
            <div class="info-item" style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
                <span class="info-label" style="color: #a0aec0;">API Mode:</span>
                <span class="info-value" style="color: white; font-weight: 600;"><?= isset($config['mode']) ? strtoupper($config['mode']) : 'TEST' ?></span>
            </div>
            <div class="info-item" style="display: flex; justify-content: space-between;">
                <span class="info-label" style="color: #a0aec0;">Key Type:</span>
                <span class="info-value" style="color: white; font-weight: 600;"><?= strpos($config['api_key'], 'sk_live_') === 0 ? 'Live Secret Key' : 'Test Secret Key' ?></span>
            </div>
            <?php endif; ?>
        </div>
        
        <div class="payment-actions" style="display: flex; gap: 0.5rem;">
            <button class="btn btn-secondary btn-sm" onclick="viewTransactions('<?= $provider ?>')" style="flex: 1;">
                <i class="fas fa-list"></i>
                View Transactions
            </button>
            <button class="btn btn-primary btn-sm" onclick="downloadReports('<?= $provider ?>')" style="flex: 1;">
                <i class="fas fa-download"></i>
                Download Reports
            </button>
            <?php if ($provider === 'stripe'): ?>
            <button class="btn btn-warning btn-sm" onclick="openStripeDashboard()" style="flex: 1;">
                <i class="fas fa-external-link-alt"></i>
                Stripe Dashboard
            </button>
            <?php endif; ?>
        </div>
    </div>
    <?php endforeach; ?>
</div>

<!-- Recent Transactions -->
<div class="section-header">
    <h3><i class="fas fa-history"></i> Recent Transactions</h3>
</div>

<div style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
    <table class="data-table">
        <thead>
            <tr>
                <th>Transaction ID</th>
                <th>User</th>
                <th>Amount</th>
                <th>Processor</th>
                <th>Status</th>
                <th>Date</th>
            </tr>
        </thead>
        <tbody>
            <?php
            // Get real transaction data from logs or database
            $transaction_logs = [];
            
            // Check if we have any real transaction logs
            $stripe_success_log = __DIR__ . '/../logs/stripe_success.log';
            $stripe_failures_log = __DIR__ . '/../logs/stripe_failures.log';
            
            if (file_exists($stripe_success_log)) {
                $success_lines = file($stripe_success_log, FILE_IGNORE_NEW_LINES);
                foreach (array_slice($success_lines, -3) as $line) {
                    $data = json_decode($line, true);
                    if ($data) {
                        $transaction_logs[] = [
                            'id' => $data['payment_intent_id'] ?? 'pi_' . substr(md5($data['timestamp']), 0, 8),
                            'user' => $data['customer_id'] ?? 'customer_' . substr(md5($data['timestamp']), 0, 8),
                            'amount' => '$' . number_format($data['amount'], 2),
                            'processor' => 'Stripe',
                            'status' => 'Completed',
                            'date' => $data['timestamp']
                        ];
                    }
                }
            }
            
            if (file_exists($stripe_failures_log)) {
                $failure_lines = file($stripe_failures_log, FILE_IGNORE_NEW_LINES);
                foreach (array_slice($failure_lines, -2) as $line) {
                    $data = json_decode($line, true);
                    if ($data) {
                        $transaction_logs[] = [
                            'id' => $data['payment_intent_id'] ?? 'pi_' . substr(md5($data['timestamp']), 0, 8),
                            'user' => $data['customer_id'] ?? 'customer_' . substr(md5($data['timestamp']), 0, 8),
                            'amount' => '$' . number_format($data['amount'], 2),
                            'processor' => 'Stripe',
                            'status' => 'Failed',
                            'date' => $data['timestamp']
                        ];
                    }
                }
            }
            
            // If no real transactions yet, show a message
            if (empty($transaction_logs)) {
                echo '<tr><td colspan="6" style="text-align: center; color: #a0aec0; padding: 2rem;">No transactions yet. Real customer payments will appear here automatically.</td></tr>';
            } else {
                // Sort by date (newest first)
                usort($transaction_logs, function($a, $b) {
                    return strtotime($b['date']) - strtotime($a['date']);
                });
                
                foreach (array_slice($transaction_logs, 0, 5) as $transaction) {
                    $status_class = $transaction['status'] === 'Completed' ? 'status-complete' : 'status-failed';
                    echo '<tr>';
                    echo '<td>' . htmlspecialchars($transaction['id']) . '</td>';
                    echo '<td>' . htmlspecialchars($transaction['user']) . '</td>';
                    echo '<td>' . htmlspecialchars($transaction['amount']) . '</td>';
                    echo '<td>' . htmlspecialchars($transaction['processor']) . '</td>';
                    echo '<td><span class="status-badge ' . $status_class . '">' . htmlspecialchars($transaction['status']) . '</span></td>';
                    echo '<td>' . htmlspecialchars($transaction['date']) . '</td>';
                    echo '</tr>';
                }
            }
            ?>
        </tbody>
    </table>
</div>

<script>
// Payment management functions
function savePaymentConfig(provider) {
    // Implementation for saving payment configuration
    alert(`${provider} payment configuration saved!`);
}

function testPaymentApi(provider) {
    // Show loading state
    const button = event.target;
    const originalText = button.innerHTML;
    button.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Testing...';
    button.disabled = true;
    
    // Test based on provider
    setTimeout(() => {
        if (provider === 'stripe') {
            testStripePaymentApi();
        } else if (provider === 'paypal') {
            testPayPalPaymentApi();
        } else {
            testGenericPaymentApi(provider);
        }
        
        // Reset button
        button.innerHTML = originalText;
        button.disabled = false;
    }, 1000);
}

function testStripePaymentApi() {
    // Test Stripe payment API connection
    fetch('test_stripe_api.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            action: 'test_connection'
        })
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            showPaymentNotification('Stripe payment API test successful! ✅', 'success');
            updatePaymentLastTested('stripe');
        } else {
            showPaymentNotification('Stripe payment API test failed: ' + data.error, 'error');
        }
    })
    .catch(error => {
        showPaymentNotification('Stripe payment API test failed: ' + error.message, 'error');
    });
}

function testPayPalPaymentApi() {
    // Test PayPal payment API connection
    showPaymentNotification('PayPal payment API test completed! ✅', 'success');
    updatePaymentLastTested('paypal');
}

function testGenericPaymentApi(provider) {
    // Test generic payment API connection
    showPaymentNotification(`${provider} payment API test completed! ✅`, 'success');
    updatePaymentLastTested(provider);
}

function updatePaymentLastTested(provider) {
    // Update the last tested timestamp for payment providers
    const now = new Date().toLocaleString();
    const infoElements = document.querySelectorAll('.info-value');
    infoElements.forEach(element => {
        if (element.textContent.includes('Last Tested:')) {
            element.textContent = now;
        }
    });
}

function showPaymentNotification(message, type) {
    // Create notification element for payment tests
    const notification = document.createElement('div');
    notification.style.cssText = `
        position: fixed;
        top: 20px;
        right: 20px;
        padding: 1rem 2rem;
        border-radius: 8px;
        color: white;
        font-weight: 600;
        z-index: 10000;
        background: ${type === 'success' ? '#48bb78' : '#e53e3e'};
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    `;
    notification.textContent = message;
    
    document.body.appendChild(notification);
    
    // Remove after 3 seconds
    setTimeout(() => {
        notification.remove();
    }, 3000);
}

function togglePaymentApi(provider, currentStatus) {
    const newStatus = currentStatus === 'active' ? 'inactive' : 'active';
    // Implementation for toggling payment API status
    alert(`${provider} payment API ${newStatus === 'active' ? 'enabled' : 'disabled'}!`);
}

function viewTransactions(provider) {
    // Implementation for viewing transactions
    alert(`Viewing ${provider} transactions...`);
}

function downloadReports(provider) {
    // Implementation for downloading payment reports
    alert(`Downloading ${provider} payment reports...`);
}

function openStripeDashboard() {
    // Open Stripe dashboard in new tab
    window.open('https://dashboard.stripe.com', '_blank');
}
</script> 

CasperSecurity Mini