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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/private_html/fix_taz_credits_now.php
<?php
/**
 * IMMEDIATE FIX: Add Stephane's 500 Credits
 * Run this in browser to add credits immediately
 */

session_start();
require_once __DIR__ . '/config/database.php';

// Only allow admin
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
    die("Access denied. Admin only.");
}

$user_id = 5; // Stephane/Taz
$credits_to_add = 500;
$package = 'premium';
$payment_intent_id = 'pi_3SbUdyD0zXLMB4gH1P4poDyJ';
$amount = 129.00;

?>
<!DOCTYPE html>
<html>
<head>
    <title>Fix Taz Credits</title>
    <style>
        body { font-family: Arial; padding: 40px; background: #1a1a1a; color: #fff; }
        .success { color: #48bb78; font-size: 1.5rem; padding: 20px; background: #48bb7820; border-radius: 8px; margin: 20px 0; }
        .error { color: #e53e3e; font-size: 1.5rem; padding: 20px; background: #e53e3e20; border-radius: 8px; margin: 20px 0; }
        .info { color: #667eea; padding: 15px; background: #667eea20; border-radius: 8px; margin: 10px 0; }
        table { width: 100%; border-collapse: collapse; margin: 20px 0; }
        th, td { padding: 12px; text-align: left; border-bottom: 1px solid #444; }
        th { background: #333; }
    </style>
</head>
<body>
    <h1>🔧 Fix Taz's 500 Credits</h1>
    
    <?php
    try {
        $pdo = getDBConnection();
        
        // Get current state
        $stmt = $pdo->prepare("SELECT id, name, email, credits, plan FROM users WHERE id = ?");
        $stmt->execute([$user_id]);
        $user = $stmt->fetch(PDO::FETCH_ASSOC);
        
        if (!$user) {
            die("<div class='error'>❌ User not found!</div>");
        }
        
        echo "<div class='info'>";
        echo "<strong>User:</strong> {$user['name']} ({$user['email']})<br>";
        echo "<strong>Current Credits:</strong> <span style='font-size: 1.5rem; color: #667eea;'>{$user['credits']}</span><br>";
        echo "<strong>Current Plan:</strong> {$user['plan']}<br>";
        echo "</div>";
        
        // Check if already added
        $check = $pdo->prepare("SELECT id, created_at FROM credit_purchases WHERE payment_intent_id = ? AND user_id = ?");
        $check->execute([$payment_intent_id, $user_id]);
        $existing = $check->fetch();
        
        if ($existing && !isset($_GET['force'])) {
            echo "<div class='success'>";
            echo "✅ Credits were already added!<br>";
            echo "Purchase record ID: {$existing['id']}<br>";
            echo "Created: {$existing['created_at']}<br>";
            echo "</div>";
            
            // Show current credits
            echo "<div class='info'>";
            echo "<strong>Current Credits:</strong> <span style='font-size: 2rem; color: #48bb78;'>{$user['credits']}</span>";
            echo "</div>";
        } else {
            // Add credits
            if (isset($_GET['confirm']) && $_GET['confirm'] === 'yes') {
                $pdo->beginTransaction();
                
                try {
                    // Add credits to user
                    $update = $pdo->prepare("UPDATE users SET credits = credits + ?, plan = ? WHERE id = ?");
                    $update->execute([$credits_to_add, $package, $user_id]);
                    
                    // Create purchase record
                    // Premium credits don't expire - use far future date (2099-12-31) since column doesn't allow NULL
                    $expires_at = '2099-12-31 23:59:59'; // Far future date for premium (never expires)
                    
                    $insert = $pdo->prepare("
                        INSERT INTO credit_purchases 
                        (user_id, package, credits, amount, payment_intent_id, expires_at, created_at) 
                        VALUES (?, ?, ?, ?, ?, ?, NOW())
                    ");
                    $insert->execute([$user_id, $package, $credits_to_add, $amount, $payment_intent_id, $expires_at]);
                    
                    $pdo->commit();
                    
                    // Get updated credits
                    $stmt = $pdo->prepare("SELECT credits FROM users WHERE id = ?");
                    $stmt->execute([$user_id]);
                    $updated = $stmt->fetch();
                    
                    echo "<div class='success'>";
                    echo "✅ <strong>SUCCESS!</strong><br>";
                    echo "Added: {$credits_to_add} credits<br>";
                    echo "New Total: <span style='font-size: 2rem;'>{$updated['credits']}</span> credits<br>";
                    echo "</div>";
                    
                    echo "<script>setTimeout(function(){ location.reload(); }, 2000);</script>";
                    
                } catch (Exception $e) {
                    $pdo->rollBack();
                    throw $e;
                }
            } else {
                echo "<div class='info'>";
                echo "<strong>Ready to add:</strong><br>";
                echo "Credits: {$credits_to_add}<br>";
                echo "Package: {$package}<br>";
                echo "Amount: \${$amount}<br>";
                echo "Payment Intent: {$payment_intent_id}<br>";
                echo "</div>";
                
                echo "<a href='?confirm=yes' style='display: inline-block; padding: 15px 30px; background: #48bb78; color: white; text-decoration: none; border-radius: 8px; font-size: 1.2rem; margin: 20px 0;' onclick=\"return confirm('Add 500 credits to Taz?');\">✅ Add 500 Credits Now</a>";
            }
        }
        
        // Show purchase history
        echo "<h2>Purchase History</h2>";
        $history = $pdo->prepare("
            SELECT id, package, credits, amount, payment_intent_id, expires_at, created_at 
            FROM credit_purchases 
            WHERE user_id = ? 
            ORDER BY created_at DESC 
            LIMIT 10
        ");
        $history->execute([$user_id]);
        $purchases = $history->fetchAll(PDO::FETCH_ASSOC);
        
        if (empty($purchases)) {
            echo "<div class='info'>No purchase records found.</div>";
        } else {
            echo "<table>";
            echo "<tr><th>ID</th><th>Package</th><th>Credits</th><th>Amount</th><th>Payment Intent</th><th>Expires</th><th>Created</th></tr>";
            foreach ($purchases as $p) {
                $highlight = ($p['payment_intent_id'] === $payment_intent_id) ? "style='background: #48bb7820;'" : "";
                echo "<tr $highlight>";
                echo "<td>{$p['id']}</td>";
                echo "<td>{$p['package']}</td>";
                echo "<td><strong>{$p['credits']}</strong></td>";
                echo "<td>\${$p['amount']}</td>";
                echo "<td><code>{$p['payment_intent_id']}</code></td>";
                echo "<td>" . ($p['expires_at'] ? date('Y-m-d', strtotime($p['expires_at'])) : 'Never') . "</td>";
                echo "<td>" . date('Y-m-d H:i:s', strtotime($p['created_at'])) . "</td>";
                echo "</tr>";
            }
            echo "</table>";
        }
        
    } catch (Exception $e) {
        echo "<div class='error'>";
        echo "❌ <strong>ERROR:</strong><br>";
        echo htmlspecialchars($e->getMessage());
        echo "</div>";
    }
    ?>
    
    <div style="margin-top: 40px;">
        <a href="/account_settings.php" style="color: #667eea;">← Back to Account</a>
    </div>
</body>
</html>

CasperSecurity Mini