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/-5edc0871/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/.cursor-server/data/User/History/-5edc0871/u5h5.php
<?php
require_once 'config/database.php';

$pdo = getDBConnection();

echo "Creating social database tables...\n";

try {
    // Create track_likes table
    $pdo->exec("
        CREATE TABLE IF NOT EXISTS track_likes (
            id INT AUTO_INCREMENT PRIMARY KEY,
            user_id INT NOT NULL,
            track_id INT NOT NULL,
            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
            UNIQUE KEY unique_like (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 "✅ Created track_likes table\n";
    
    // Create track_comments table
    $pdo->exec("
        CREATE TABLE IF NOT EXISTS track_comments (
            id INT AUTO_INCREMENT PRIMARY KEY,
            user_id INT NOT NULL,
            track_id INT NOT NULL,
            comment TEXT NOT NULL,
            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
            FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
            FOREIGN KEY (track_id) REFERENCES music_tracks(id) ON DELETE CASCADE
        )
    ");
    echo "✅ Created track_comments table\n";
    
    // Create user_follows table
    $pdo->exec("
        CREATE TABLE IF NOT EXISTS user_follows (
            id INT AUTO_INCREMENT PRIMARY KEY,
            follower_id INT NOT NULL,
            following_id INT NOT NULL,
            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
            UNIQUE KEY unique_follow (follower_id, following_id),
            FOREIGN KEY (follower_id) REFERENCES users(id) ON DELETE CASCADE,
            FOREIGN KEY (following_id) REFERENCES users(id) ON DELETE CASCADE
        )
    ");
    echo "✅ Created user_follows table\n";
    
    // Add some demo data
    echo "Adding demo social data...\n";
    
    // Get some existing users and tracks
    $users = $pdo->query("SELECT id FROM users LIMIT 5")->fetchAll();
    $tracks = $pdo->query("SELECT id FROM music_tracks WHERE status = 'complete' LIMIT 10")->fetchAll();
    
    if (!empty($users) && !empty($tracks)) {
        // Add some demo likes
        foreach ($tracks as $track) {
            $random_users = array_rand($users, min(3, count($users)));
            if (!is_array($random_users)) {
                $random_users = [$random_users];
            }
            foreach ($random_users as $user_index) {
                try {
                    $pdo->prepare("INSERT IGNORE INTO track_likes (user_id, track_id) VALUES (?, ?)")
                        ->execute([$users[$user_index]['id'], $track['id']]);
                } catch (Exception $e) {
                    // Ignore duplicate key errors
                }
            }
        }
        echo "✅ Added demo likes\n";
        
        // Add some demo follows
        for ($i = 0; $i < min(5, count($users) - 1); $i++) {
            try {
                $pdo->prepare("INSERT IGNORE INTO user_follows (follower_id, following_id) VALUES (?, ?)")
                    ->execute([$users[$i]['id'], $users[$i + 1]['id']]);
            } catch (Exception $e) {
                // Ignore duplicate key errors
            }
        }
        echo "✅ Added demo follows\n";
        
        // Add some demo comments
        $comments = [
            "Amazing track! Love the vibe 🎵",
            "This is incredible! How did you create this?",
            "Perfect for my playlist!",
            "The AI really captured the mood here",
            "Can't stop listening to this!",
            "Great work! Keep creating!",
            "This is exactly what I was looking for",
            "The production quality is outstanding",
            "Love the melody and rhythm",
            "This is going viral for sure!"
        ];
        
        foreach ($tracks as $track) {
            $random_comment = $comments[array_rand($comments)];
            $random_user = $users[array_rand($users)];
            try {
                $pdo->prepare("INSERT INTO track_comments (user_id, track_id, comment) VALUES (?, ?, ?)")
                    ->execute([$random_user['id'], $track['id'], $random_comment]);
            } catch (Exception $e) {
                // Ignore errors
            }
        }
        echo "✅ Added demo comments\n";
    }
    
    echo "\n🎉 Social database setup complete!\n";
    echo "Tables created:\n";
    echo "- track_likes: For users to like tracks\n";
    echo "- track_comments: For users to comment on tracks\n";
    echo "- user_follows: For users to follow each other\n";
    
} catch (Exception $e) {
    echo "❌ Error: " . $e->getMessage() . "\n";
}
?> 

CasperSecurity Mini