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/admin_check_user_5_purchases.php
<?php
/**
 * Diagnostic script to check user ID 5's purchases and tracks
 */

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

// Check if admin
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
    die("Admin access required");
}

$pdo = getDBConnection();
$user_id = 5;

echo "<h2>User ID 5 (Stephane Bergeron) - Purchase & Track Analysis</h2>";
echo "<style>
    body { font-family: Arial; padding: 20px; background: #1a1a1a; color: white; }
    table { border-collapse: collapse; width: 100%; margin: 20px 0; background: #2a2a2a; }
    th, td { border: 1px solid #444; padding: 10px; text-align: left; }
    th { background: #667eea; color: white; }
    .success { color: #48bb78; }
    .error { color: #e53e3e; }
    .warning { color: #ffc107; }
    .info { color: #667eea; }
    .section { margin: 30px 0; padding: 20px; background: #2a2a2a; border-radius: 8px; }
</style>";

// Get user info
$stmt = $pdo->prepare("SELECT id, name, email FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);

echo "<div class='section'>";
echo "<h3>User Information</h3>";
echo "<p><strong>ID:</strong> {$user['id']}</p>";
echo "<p><strong>Name:</strong> {$user['name']}</p>";
echo "<p><strong>Email:</strong> {$user['email']}</p>";
echo "</div>";

// Get all purchases
echo "<div class='section'>";
echo "<h3>All Purchases (track_purchases table)</h3>";
$stmt = $pdo->prepare("
    SELECT 
        tp.*,
        mt.title as track_title,
        mt.user_id as track_creator_id,
        u.name as track_creator_name
    FROM track_purchases tp
    JOIN music_tracks mt ON tp.track_id = mt.id
    JOIN users u ON mt.user_id = u.id
    WHERE tp.user_id = ?
    ORDER BY tp.purchase_date DESC
");
$stmt->execute([$user_id]);
$purchases = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo "<p class='info'>Total purchases found: " . count($purchases) . "</p>";

if (empty($purchases)) {
    echo "<p class='warning'>No purchases found in track_purchases table</p>";
} else {
    echo "<table>";
    echo "<tr><th>Purchase ID</th><th>Track ID</th><th>Track Title</th><th>Created By</th><th>Price Paid</th><th>Purchase Date</th></tr>";
    foreach ($purchases as $p) {
        echo "<tr>";
        echo "<td>{$p['id']}</td>";
        echo "<td>{$p['track_id']}</td>";
        echo "<td>" . htmlspecialchars($p['track_title'] ?: 'N/A') . "</td>";
        echo "<td>{$p['track_creator_name']} (ID: {$p['track_creator_id']})</td>";
        echo "<td>\${$p['price_paid']}</td>";
        echo "<td>{$p['purchase_date']}</td>";
        echo "</tr>";
    }
    echo "</table>";
}
echo "</div>";

// Get user library
echo "<div class='section'>";
echo "<h3>User Library (user_library table)</h3>";
$stmt = $pdo->prepare("
    SELECT 
        ul.*,
        mt.title as track_title,
        mt.user_id as track_creator_id,
        u.name as track_creator_name
    FROM user_library ul
    JOIN music_tracks mt ON ul.track_id = mt.id
    JOIN users u ON mt.user_id = u.id
    WHERE ul.user_id = ?
    ORDER BY ul.purchase_date DESC
");
$stmt->execute([$user_id]);
$library = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo "<p class='info'>Total tracks in library: " . count($library) . "</p>";

if (empty($library)) {
    echo "<p class='warning'>No tracks found in user_library table</p>";
} else {
    echo "<table>";
    echo "<tr><th>Library ID</th><th>Track ID</th><th>Track Title</th><th>Created By</th><th>Added Date</th></tr>";
    foreach ($library as $l) {
        echo "<tr>";
        echo "<td>{$l['id']}</td>";
        echo "<td>{$l['track_id']}</td>";
        echo "<td>" . htmlspecialchars($l['track_title'] ?: 'N/A') . "</td>";
        echo "<td>{$l['track_creator_name']} (ID: {$l['track_creator_id']})</td>";
        echo "<td>{$l['purchase_date']}</td>";
        echo "</tr>";
    }
    echo "</table>";
}
echo "</div>";

// Get tracks created by user (what shows on profile)
echo "<div class='section'>";
echo "<h3>Tracks Created by User (Shown on Artist Profile)</h3>";
$stmt = $pdo->prepare("
    SELECT 
        id,
        title,
        status,
        is_public,
        created_at
    FROM music_tracks
    WHERE user_id = ?
    AND status = 'complete'
    AND is_public = 1
    ORDER BY created_at DESC
    LIMIT 20
");
$stmt->execute([$user_id]);
$created_tracks = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo "<p class='info'>Total tracks created (public & complete): " . count($created_tracks) . "</p>";

if (empty($created_tracks)) {
    echo "<p class='warning'>No tracks created by this user</p>";
} else {
    echo "<table>";
    echo "<tr><th>Track ID</th><th>Title</th><th>Status</th><th>Public</th><th>Created</th></tr>";
    foreach ($created_tracks as $t) {
        echo "<tr>";
        echo "<td>{$t['id']}</td>";
        echo "<td>" . htmlspecialchars($t['title'] ?: 'N/A') . "</td>";
        echo "<td>{$t['status']}</td>";
        echo "<td>" . ($t['is_public'] ? 'Yes' : 'No') . "</td>";
        echo "<td>{$t['created_at']}</td>";
        echo "</tr>";
    }
    echo "</table>";
}
echo "</div>";

// Check for any tracks that might be incorrectly associated
echo "<div class='section'>";
echo "<h3>Verification: Are purchased tracks showing on profile?</h3>";

$purchased_track_ids = array_column($purchases, 'track_id');
$created_track_ids = array_column($created_tracks, 'id');

$overlap = array_intersect($purchased_track_ids, $created_track_ids);

if (!empty($overlap)) {
    echo "<p class='error'>⚠️ WARNING: Found tracks that are both purchased AND created by user:</p>";
    echo "<ul>";
    foreach ($overlap as $track_id) {
        echo "<li>Track ID: $track_id</li>";
    }
    echo "</ul>";
} else {
    echo "<p class='success'>✓ No overlap - purchased tracks are different from created tracks (as expected)</p>";
}

echo "<p class='info'>Purchased track IDs: " . implode(', ', $purchased_track_ids) . "</p>";
echo "<p class='info'>Created track IDs (first 10): " . implode(', ', array_slice($created_track_ids, 0, 10)) . "</p>";
echo "</div>";

echo "<hr>";
echo "<p><a href='/admin.php?tab=tracks' style='color: #667eea;'>← Back to Admin</a> | ";
echo "<a href='/artist_profile.php?id={$user_id}' style='color: #667eea;'>View Artist Profile</a> | ";
echo "<a href='/account_settings.php?tab=purchases' style='color: #667eea;'>View Purchases Page</a></p>";
?>


CasperSecurity Mini