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/6d0b4644/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/.cursor-server/data/User/History/6d0b4644/YtAe.php
<?php
require_once 'config/database.php';
session_start();

$user_id = $_SESSION['user_id'] ?? null;
$pdo = getDBConnection();

// Get a sample track
$track = null;
if ($pdo) {
    $stmt = $pdo->query("SELECT id, title FROM music_tracks LIMIT 1");
    $track = $stmt->fetch();
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Likes & Comments Test</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; }
        .test-section { margin: 20px 0; padding: 20px; border: 1px solid #ccc; }
        .like-btn { padding: 10px 20px; margin: 10px; cursor: pointer; }
        .liked { background: #ff6b6b; color: white; }
        .comment-input { width: 300px; height: 100px; margin: 10px 0; }
        .status { padding: 10px; margin: 10px 0; border-radius: 5px; }
        .success { background: #d4edda; color: #155724; }
        .error { background: #f8d7da; color: #721c24; }
        .warning { background: #fff3cd; color: #856404; }
    </style>
</head>
<body>
    <h1>๐Ÿ” Simple Likes & Comments Test</h1>
    
    <div class="test-section">
        <h2>๐Ÿ‘ค User Status</h2>
        <?php if ($user_id): ?>
            <div class="status success">โœ… Logged in as User ID: <?= $user_id ?></div>
        <?php else: ?>
            <div class="status warning">โš ๏ธ Not logged in - <a href="/login.php">Login here</a></div>
        <?php endif; ?>
    </div>

    <?php if ($track && $user_id): ?>
        <div class="test-section">
            <h2>๐ŸŽต Test Track</h2>
            <p><strong>Track ID:</strong> <?= $track['id'] ?></p>
            <p><strong>Title:</strong> <?= $track['title'] ?></p>
            
            <h3>โค๏ธ Like Test</h3>
            <button class="like-btn" onclick="testLike(<?= $track['id'] ?>)">
                โค๏ธ Test Like
            </button>
            <div id="like-status"></div>
            
            <h3>๐Ÿ’ฌ Comment Test</h3>
            <textarea class="comment-input" id="comment-text" placeholder="Enter a test comment..."></textarea><br>
            <button onclick="testComment(<?= $track['id'] ?>)">๐Ÿ’ฌ Test Comment</button>
            <div id="comment-status"></div>
        </div>
    <?php else: ?>
        <div class="test-section">
            <div class="status error">
                โŒ Cannot test: <?= !$track ? 'No tracks found' : 'User not logged in' ?>
            </div>
        </div>
    <?php endif; ?>

    <div class="test-section">
        <h2>๐Ÿ”ง Manual API Test</h2>
        <p>Open browser console and run these commands:</p>
        <pre>
// Test like API
fetch('/api_social.php', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ action: 'like', track_id: 1 })
}).then(r => r.json()).then(console.log)

// Test comment API  
fetch('/api_social.php', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ action: 'comment', track_id: 1, comment: 'Test comment' })
}).then(r => r.json()).then(console.log)
        </pre>
    </div>

    <script>
        function testLike(trackId) {
            console.log('๐Ÿงช Testing like for track:', trackId);
            
            fetch('/api_social.php', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ action: 'like', track_id: trackId })
            })
            .then(response => {
                console.log('Response status:', response.status);
                return response.json();
            })
            .then(data => {
                console.log('Like response:', data);
                const status = document.getElementById('like-status');
                if (data.success) {
                    status.innerHTML = `<div class="status success">โœ… Like successful: ${data.action}</div>`;
                } else {
                    status.innerHTML = `<div class="status error">โŒ Like failed: ${data.message}</div>`;
                }
            })
            .catch(error => {
                console.error('Like error:', error);
                document.getElementById('like-status').innerHTML = 
                    `<div class="status error">โŒ Error: ${error.message}</div>`;
            });
        }

        function testComment(trackId) {
            const commentText = document.getElementById('comment-text').value.trim();
            if (!commentText) {
                alert('Please enter a comment');
                return;
            }
            
            console.log('๐Ÿงช Testing comment for track:', trackId, 'Text:', commentText);
            
            fetch('/api_social.php', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ 
                    action: 'comment', 
                    track_id: trackId, 
                    comment: commentText 
                })
            })
            .then(response => {
                console.log('Response status:', response.status);
                return response.json();
            })
            .then(data => {
                console.log('Comment response:', data);
                const status = document.getElementById('comment-status');
                if (data.success) {
                    status.innerHTML = `<div class="status success">โœ… Comment posted successfully!</div>`;
                    document.getElementById('comment-text').value = '';
                } else {
                    status.innerHTML = `<div class="status error">โŒ Comment failed: ${data.message}</div>`;
                }
            })
            .catch(error => {
                console.error('Comment error:', error);
                document.getElementById('comment-status').innerHTML = 
                    `<div class="status error">โŒ Error: ${error.message}</div>`;
            });
        }

        // Log any JavaScript errors
        window.addEventListener('error', function(e) {
            console.error('JavaScript error:', e.error);
        });
    </script>
</body>
</html>

CasperSecurity Mini