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/generate_sitemap_tracks.php
<?php
/**
 * Generate Sitemap for Tracks
 * This script generates a sitemap.xml file containing all public tracks
 * for better SEO and Google indexing
 */

require_once 'config/database.php';

header('Content-Type: application/xml; charset=utf-8');

try {
    $pdo = getDBConnection();
    
    // Get all public, complete tracks
    $query = "
        SELECT 
            mt.id,
            mt.title,
            mt.created_at,
            mt.updated_at,
            u.name as artist_name
        FROM music_tracks mt
        JOIN users u ON mt.user_id = u.id
        WHERE mt.status = 'complete'
        AND (mt.is_public = 1 OR mt.is_public IS NULL)
        ORDER BY mt.created_at DESC
    ";
    
    $stmt = $pdo->query($query);
    $tracks = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    // Start XML output
    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
    
    $base_url = 'https://soundstudiopro.com';
    
    foreach ($tracks as $track) {
        $track_url = $base_url . '/track.php?id=' . $track['id'];
        
        // Use updated_at if available, otherwise use created_at
        $lastmod = !empty($track['updated_at']) ? $track['updated_at'] : $track['created_at'];
        $lastmod_date = date('Y-m-d', strtotime($lastmod));
        
        // Determine priority based on recency (newer tracks get higher priority)
        $days_old = (time() - strtotime($track['created_at'])) / 86400;
        if ($days_old < 7) {
            $priority = '0.9'; // Very new tracks
        } elseif ($days_old < 30) {
            $priority = '0.8'; // Recent tracks
        } elseif ($days_old < 90) {
            $priority = '0.7'; // Moderately old
        } else {
            $priority = '0.6'; // Older tracks
        }
        
        echo "  <url>\n";
        echo "    <loc>" . htmlspecialchars($track_url, ENT_XML1, 'UTF-8') . "</loc>\n";
        echo "    <lastmod>" . htmlspecialchars($lastmod_date, ENT_XML1, 'UTF-8') . "</lastmod>\n";
        echo "    <changefreq>weekly</changefreq>\n";
        echo "    <priority>" . $priority . "</priority>\n";
        echo "  </url>\n";
    }
    
    echo '</urlset>' . "\n";
    
} catch (Exception $e) {
    // On error, output minimal valid sitemap
    header('Content-Type: application/xml; charset=utf-8');
    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
    echo '</urlset>' . "\n";
    error_log("Sitemap generation error: " . $e->getMessage());
}

CasperSecurity Mini