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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/private_html/utils/create_fix.php
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
    echo "<div style='background: #f56565; color: white; padding: 20px; margin: 20px; border-radius: 10px;'>";
    echo "<h2>🔒 Authentication Required</h2>";
    echo "<p>You need to be logged in to access the music creation page.</p>";
    echo "<p><a href='/auth/login.php' style='color: white; text-decoration: underline;'>Click here to login</a></p>";
    echo "</div>";
    exit;
}

require_once 'config/database.php';

$pdo = getDBConnection();

if (!$pdo) {
    echo "<div style='background: #f56565; color: white; padding: 20px; margin: 20px; border-radius: 10px;'>";
    echo "<h2>❌ Database Connection Failed</h2>";
    echo "<p>Unable to connect to the database. Please contact support.</p>";
    echo "</div>";
    exit;
}

// Get user name from database
$stmt = $pdo->prepare("SELECT name, credits FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();

if (!$user) {
    echo "<div style='background: #f56565; color: white; padding: 20px; margin: 20px; border-radius: 10px;'>";
    echo "<h2>❌ User Not Found</h2>";
    echo "<p>Your user account could not be found in the database.</p>";
    echo "</div>";
    exit;
}

$user_name = $user['name'] ?? 'User';
$credits = $user['credits'] ?? 0;

// Update session credits
$_SESSION['credits'] = $credits;

// Set page variables for header
$page_title = 'Create Music - SoundStudioPro';
$page_description = 'Create professional AI-generated music with custom prompts and advanced settings.';

// Include header
include 'includes/header.php';
?>

<style>
    /* Main Content */
    .main-content {
        margin-top: 10rem;
        padding: 4rem 0;
        min-height: calc(100vh - 10rem);
    }
    
    /* Hero Section */
    .hero {
        padding: 8rem 0 6rem;
        text-align: center;
        color: white;
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
        position: relative;
        overflow: hidden;
        margin-bottom: 4rem;
    }
    
    .hero-content {
        max-width: 90rem;
        margin: 0 auto;
        position: relative;
        z-index: 2;
    }
    
    .hero-badge {
        display: inline-block;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
        color: #667eea;
        padding: 1.2rem 2.4rem;
        border-radius: 50px;
        font-size: 1.4rem;
        font-weight: 600;
        margin-bottom: 3rem;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(102, 126, 234, 0.3);
    }
    
    .hero-title {
        font-size: 5.6rem;
        font-weight: 900;
        line-height: 1.1;
        margin-bottom: 2.4rem;
        background: linear-gradient(135deg, #ffffff, #667eea, #764ba2);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .hero-subtitle {
        font-size: 2rem;
        font-weight: 400;
        margin-bottom: 4rem;
        opacity: 0.9;
        max-width: 70rem;
        margin-left: auto;
        margin-right: auto;
        color: #a0aec0;
    }
    
    /* Create Content */
    .create-content {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        padding: 6rem 0;
        border-radius: 40px 40px 0 0;
        margin-top: -2rem;
        position: relative;
        z-index: 10;
    }
    
    .create-container {
        max-width: 80rem;
        margin: 0 auto;
    }
    
    /* Credits Info */
    .credits-info {
        background: rgba(102, 126, 234, 0.1);
        border: 1px solid rgba(102, 126, 234, 0.3);
        border-radius: 16px;
        padding: 3rem;
        margin-bottom: 4rem;
        text-align: center;
        backdrop-filter: blur(20px);
    }
    
    .credits-number {
        font-size: 3.6rem;
        font-weight: 900;
        color: #667eea;
        margin-bottom: 1rem;
    }
    
    .credits-label {
        font-size: 1.6rem;
        color: #a0aec0;
        font-weight: 500;
    }
    
    /* Create Form */
    .create-form {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 24px;
        padding: 4rem;
        backdrop-filter: blur(20px);
    }
    
    .form-group {
        margin-bottom: 3rem;
    }
    
    .form-label {
        display: block;
        font-size: 1.6rem;
        font-weight: 600;
        margin-bottom: 1rem;
        color: white;
    }
    
    .form-input,
    .form-textarea,
    .form-select {
        width: 100%;
        padding: 1.5rem 2rem;
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.05);
        color: white;
        font-size: 1.6rem;
        transition: all 0.3s ease;
    }
    
    .form-input:focus,
    .form-textarea:focus,
    .form-select:focus {
        outline: none;
        border-color: #667eea;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .form-textarea {
        min-height: 15rem;
        resize: vertical;
    }
    
    .submit-btn {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        border: none;
        padding: 2rem 3rem;
        border-radius: 16px;
        font-size: 1.8rem;
        font-weight: 700;
        cursor: pointer;
        width: 100%;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }
    
    .submit-btn:hover:not(:disabled) {
        transform: translateY(-3px);
        box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
    }
    
    .submit-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
    }
    
    /* Results Section */
    .results-section {
        margin-top: 4rem;
        display: none;
    }
    
    .results-header {
        text-align: center;
        margin-bottom: 3rem;
    }
    
    .results-title {
        font-size: 3.2rem;
        font-weight: 700;
        color: white;
        margin-bottom: 1rem;
    }
    
    .audio-player {
        background: rgba(255, 255, 255, 0.05);
        padding: 3rem;
        border-radius: 20px;
        margin-bottom: 2rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .audio-player audio {
        width: 100%;
        border-radius: 12px;
    }
    
    .download-btn {
        display: inline-flex;
        align-items: center;
        gap: 1rem;
        padding: 1.5rem 3rem;
        background: linear-gradient(135deg, #48bb78, #38a169);
        color: white;
        text-decoration: none;
        border-radius: 12px;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .download-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 30px rgba(72, 187, 120, 0.3);
    }
    
    /* Error/Success Messages */
    .message {
        padding: 2rem;
        border-radius: 12px;
        margin-bottom: 2rem;
        font-weight: 600;
    }
    
    .message.error {
        background: rgba(245, 101, 101, 0.1);
        border: 1px solid rgba(245, 101, 101, 0.3);
        color: #f56565;
    }
    
    .message.success {
        background: rgba(72, 187, 120, 0.1);
        border: 1px solid rgba(72, 187, 120, 0.3);
        color: #48bb78;
    }
    
    .message.warning {
        background: rgba(237, 137, 54, 0.1);
        border: 1px solid rgba(237, 137, 54, 0.3);
        color: #ed8936;
    }
</style>

<!-- Hero Section -->
<section class="hero">
    <div class="container">
        <div class="hero-content">
            <div class="hero-badge">🎵 Create Music</div>
            <h1 class="hero-title">Create Professional AI Music</h1>
            <p class="hero-subtitle">Generate studio-quality music with custom prompts. Choose from multiple AI models and create tracks that match your creative vision.</p>
        </div>
    </div>
</section>

<!-- Create Content -->
<section class="create-content">
    <div class="container">
        <div class="create-container">
            <!-- Credits Info -->
            <div class="credits-info">
                <div class="credits-number"><?= $credits ?></div>
                <div class="credits-label">Credits Available</div>
                <?php if ($credits < 1): ?>
                    <div class="message warning" style="margin-top: 2rem;">
                        ⚠️ You need at least 1 credit to create music. <a href="/pricing.php" style="color: #ed8936;">Get more credits</a>
                    </div>
                <?php endif; ?>
            </div>
            
            <!-- Create Form -->
            <div class="create-form">
                <form id="musicForm">
                    <div class="form-group">
                        <label class="form-label">Track Title</label>
                        <input type="text" class="form-input" id="title" placeholder="Enter a title for your track (e.g., 'Summer Vibes', 'Night Drive')" required>
                    </div>
                    
                    <div class="form-group">
                        <label class="form-label">Music Description</label>
                        <textarea class="form-textarea" id="prompt" placeholder="Describe the music you want to create. Be specific about genre, mood, instruments, tempo, etc. Example: 'An upbeat electronic dance track with heavy bass, synthesizers, and a driving beat. Should be energetic and perfect for a workout playlist.'" required></textarea>
                    </div>
                    
                    <div class="form-group">
                        <label class="form-label">Style</label>
                        <select class="form-select" id="style">
                            <option value="Pop">Pop</option>
                            <option value="Rock">Rock</option>
                            <option value="Electronic">Electronic</option>
                            <option value="Hip Hop">Hip Hop</option>
                            <option value="Jazz">Jazz</option>
                            <option value="Classical">Classical</option>
                            <option value="Country">Country</option>
                            <option value="R&B">R&B</option>
                            <option value="Reggae">Reggae</option>
                            <option value="Blues">Blues</option>
                            <option value="Folk">Folk</option>
                            <option value="Metal">Metal</option>
                            <option value="Punk">Punk</option>
                            <option value="Indie">Indie</option>
                            <option value="Ambient">Ambient</option>
                            <option value="Chill">Chill</option>
                            <option value="EDM">EDM</option>
                            <option value="House">House</option>
                            <option value="Techno">Techno</option>
                            <option value="Trance">Trance</option>
                        </select>
                    </div>
                    
                    <div class="form-group">
                        <label class="form-label">Duration (seconds)</label>
                        <input type="number" class="form-input" id="duration" value="30" min="10" max="300" required>
                    </div>
                    
                    <button type="submit" class="submit-btn" id="createBtn" <?= $credits < 1 ? 'disabled' : '' ?>>
                        <span id="loading" style="display: none;">
                            <i class="fas fa-spinner fa-spin"></i> Creating Music...
                        </span>
                        <span id="createText">
                            <i class="fas fa-magic"></i> Create Music
                        </span>
                    </button>
                </form>
                
                <!-- Results Section -->
                <div id="results" class="results-section">
                    <div class="results-header">
                        <h3 class="results-title">Your Music is Ready!</h3>
                    </div>
                    
                    <div id="audioPlayer" class="audio-player">
                        <audio id="audioElement" controls>
                            Your browser does not support the audio element.
                        </audio>
                    </div>
                    
                    <a id="downloadBtn" href="#" class="download-btn">
                        <i class="fas fa-download"></i> Download MP3
                    </a>
                </div>
            </div>
        </div>
    </div>
</section>

<script>
    // Secure API Configuration
    const API_ENDPOINT = window.location.protocol + '//' + window.location.host + '/api.php';
    
    // DOM Elements
    const musicForm = document.getElementById('musicForm');
    const createBtn = document.getElementById('createBtn');
    const loading = document.getElementById('loading');
    const results = document.getElementById('results');
    const audioElement = document.getElementById('audioElement');
    const downloadBtn = document.getElementById('downloadBtn');
    
    // Form submission handler
    musicForm.addEventListener('submit', async (e) => {
        e.preventDefault();
        
        const title = document.getElementById('title').value;
        const prompt = document.getElementById('prompt').value;
        const style = document.getElementById('style').value;
        const duration = document.getElementById('duration').value;
        
        // Show loading
        createBtn.disabled = true;
        loading.style.display = 'block';
        results.style.display = 'none';
        
        try {
            // Prepare request data
            const requestData = {
                type: 'music',
                title: title,
                prompt: prompt,
                model: 'V3_5',
                style: style,
                duration: parseInt(duration),
                instrumental: false,
                customMode: true
            };
            
            console.log('Sending request:', requestData);
            
            // Make API request
            const response = await fetch(API_ENDPOINT, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(requestData)
            });
            
            if (!response.ok) {
                const errorText = await response.text();
                throw new Error(`HTTP error! status: ${response.status}, message: ${errorText}`);
            }
            
            const result = await response.json();
            
            if (!result.success) {
                throw new Error(result.error || 'Unknown error occurred');
            }
            
            // Check if this is a processing response (callback-based)
            if (result.data && result.data.status === 'processing' && result.data.taskId) {
                // Start polling for results
                pollForResults(result.data.taskId);
            } else {
                // Direct result (for non-callback operations)
                displayResults(result.data);
            }
            
        } catch (error) {
            console.error('Error creating music:', error);
            
            // Show error message
            const errorDiv = document.createElement('div');
            errorDiv.className = 'message error';
            errorDiv.innerHTML = `<strong>Error:</strong> ${error.message}`;
            
            const form = document.getElementById('musicForm');
            form.insertBefore(errorDiv, form.firstChild);
            
            // Remove error message after 5 seconds
            setTimeout(() => {
                if (errorDiv.parentNode) {
                    errorDiv.parentNode.removeChild(errorDiv);
                }
            }, 5000);
        } finally {
            // Hide loading
            createBtn.disabled = false;
            loading.style.display = 'none';
        }
    });
    
    // Poll for task results
    async function pollForResults(taskId) {
        const maxAttempts = 60; // 5 minutes with 5-second intervals
        let attempts = 0;
        
        const pollInterval = setInterval(async () => {
            attempts++;
            
            try {
                const response = await fetch(`/get_result.php?taskId=${taskId}`, {
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json'
                    }
                });
                
                if (!response.ok) {
                    throw new Error(`HTTP error! status: ${response.status}`);
                }
                
                const result = await response.json();
                
                if (result.success && result.status === 'complete') {
                    clearInterval(pollInterval);
                    displayResults(result.data);
                    createBtn.disabled = false;
                    loading.style.display = 'none';
                } else if (result.success && result.status === 'processing') {
                    // Update loading message
                    const loadingText = document.querySelector('#loading');
                    if (loadingText) {
                        loadingText.innerHTML = `<i class="fas fa-spinner fa-spin"></i> Creating your music... (${attempts}/${maxAttempts})`;
                    }
                    
                    // Check if we've exceeded max attempts
                    if (attempts >= maxAttempts) {
                        clearInterval(pollInterval);
                        throw new Error('Music generation timed out. Please try again.');
                    }
                } else {
                    throw new Error(result.error || 'Unknown error occurred');
                }
                
            } catch (error) {
                clearInterval(pollInterval);
                console.error('Polling error:', error);
                
                const errorDiv = document.createElement('div');
                errorDiv.className = 'message error';
                errorDiv.innerHTML = `<strong>Polling Error:</strong> ${error.message}`;
                
                const form = document.getElementById('musicForm');
                form.insertBefore(errorDiv, form.firstChild);
                
                createBtn.disabled = false;
                loading.style.display = 'none';
            }
        }, 5000); // Poll every 5 seconds
    }
    
    // Display results
    function displayResults(data) {
        results.style.display = 'block';
        
        console.log('Displaying results:', data);
        
        // Handle api.box callback data format
        if (data && data.audio_url) {
            audioElement.src = data.audio_url;
            downloadBtn.href = data.audio_url;
            downloadBtn.download = 'soundstudiopro-creation.mp3';
        } else if (data && data.data && data.data.audio_url) {
            // Nested data format from callback
            audioElement.src = data.data.audio_url;
            downloadBtn.href = data.data.audio_url;
            downloadBtn.download = 'soundstudiopro-creation.mp3';
        } else {
            // Fallback for other types
            const audioPlayer = document.getElementById('audioPlayer');
            audioPlayer.innerHTML = `
                <div style="color: white; text-align: center; padding: 2rem;">
                    <h4 style="margin-bottom: 1rem;">Processing Complete!</h4>
                    <p>Your music has been generated successfully.</p>
                    <p style="font-size: 1.4rem; color: #a0aec0; margin-top: 1rem;">Check the console for detailed response data.</p>
                </div>
            `;
            console.log('API Response:', data);
        }
    }
</script>

<?php include 'includes/footer.php'; ?> 

CasperSecurity Mini