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/.cursor-server/data/User/History/-2ea5fbb1/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/.cursor-server/data/User/History/-2ea5fbb1/y28s.php
<?php
/**
 * Fix Orphaned Tracks
 * 
 * This script finds tracks that don't have proper user assignment and assigns them to admin.
 */

require_once 'config/database.php';

$pdo = getDBConnection();

echo "<h1>🔧 Fixing Orphaned Tracks</h1>";

// Find admin user ID
$stmt = $pdo->prepare("SELECT id FROM users WHERE is_admin = 1 LIMIT 1");
$stmt->execute();
$admin = $stmt->fetch();

if (!$admin) {
    echo "<p style='color: red;'>❌ No admin user found</p>";
    exit;
}

$admin_id = $admin['id'];
echo "<h2>👑 Admin User ID: $admin_id</h2>";

// Find tracks that need to be assigned to admin
$stmt = $pdo->prepare("
    SELECT id, title, user_id, task_id, status, created_at 
    FROM music_tracks 
    WHERE user_id IS NULL OR user_id = 0 OR user_id NOT IN (SELECT id FROM users)
    ORDER BY created_at DESC
");
$stmt->execute();
$orphaned_tracks = $stmt->fetchAll();

echo "<h2>📊 Found " . count($orphaned_tracks) . " orphaned tracks</h2>";

if (empty($orphaned_tracks)) {
    echo "<p style='color: green;'>✅ No orphaned tracks found!</p>";
    exit;
}

$updated_count = 0;

foreach ($orphaned_tracks as $track) {
    echo "<h3>🔍 Track: " . htmlspecialchars($track['title']) . "</h3>";
    echo "<p><strong>ID:</strong> {$track['id']}</p>";
    echo "<p><strong>Current User ID:</strong> " . ($track['user_id'] ?: 'NULL') . "</p>";
    echo "<p><strong>Status:</strong> {$track['status']}</p>";
    echo "<p><strong>Created:</strong> {$track['created_at']}</p>";
    
    // Update the track to belong to admin
    $stmt = $pdo->prepare("UPDATE music_tracks SET user_id = ? WHERE id = ?");
    $stmt->execute([$admin_id, $track['id']]);
    
    if ($stmt->rowCount() > 0) {
        echo "<p style='color: green;'>✅ Successfully assigned to admin</p>";
        $updated_count++;
    } else {
        echo "<p style='color: red;'>❌ Failed to update</p>";
    }
    
    echo "<hr>";
}

echo "<h2>📊 Fix Complete!</h2>";
echo "<p><strong>Orphaned tracks found:</strong> " . count($orphaned_tracks) . "</p>";
echo "<p><strong>Successfully updated:</strong> $updated_count</p>";

if ($updated_count > 0) {
    echo "<h3>✅ Success!</h3>";
    echo "<p>All orphaned tracks have been assigned to the admin account.</p>";
}

echo "<h3>🔗 Quick Links</h3>";
echo "<ul>";
echo "<li><a href='admin.php'>👑 Admin Panel</a></li>";
echo "<li><a href='library_new.php'>📚 My Library</a></li>";
echo "</ul>";
?> 

CasperSecurity Mini