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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/webhooks/social.php
<?php
// Social Media Webhook Handler
// Handles incoming webhook events from social media platforms

// Set content type to JSON
header('Content-Type: application/json');

// Get the raw POST data
$payload = file_get_contents('php://input');
$headers = getallheaders();

// Log the webhook event
$log_data = [
    'timestamp' => date('Y-m-d H:i:s'),
    'headers' => $headers,
    'payload' => $payload,
    'ip_address' => $_SERVER['REMOTE_ADDR'] ?? 'unknown',
    'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'unknown'
];

// Write to log file
$log_file = __DIR__ . '/../logs/social_webhooks.log';
$log_entry = json_encode($log_data) . "\n";
file_put_contents($log_file, $log_entry, FILE_APPEND | LOCK_EX);

// Parse the payload
$data = json_decode($payload, true);

if (!$data) {
    http_response_code(400);
    echo json_encode(['error' => 'Invalid JSON payload']);
    exit();
}

// Handle different social media events
$event_type = $data['event_type'] ?? 'unknown';
$platform = $data['platform'] ?? 'unknown';

switch ($event_type) {
    case 'user.login':
        handleUserLogin($data);
        break;
        
    case 'track.shared':
        handleTrackShared($data);
        break;
        
    case 'playlist.created':
        handlePlaylistCreated($data);
        break;
        
    case 'comment.posted':
        handleCommentPosted($data);
        break;
        
    case 'like.added':
        handleLikeAdded($data);
        break;
        
    default:
        // Unknown event type
        $unknown_log = [
            'timestamp' => date('Y-m-d H:i:s'),
            'event' => 'unknown_event_type',
            'event_type' => $event_type,
            'platform' => $platform,
            'data' => $data
        ];
        
        $unknown_log_file = __DIR__ . '/../logs/social_unknown.log';
        file_put_contents($unknown_log_file, json_encode($unknown_log) . "\n", FILE_APPEND | LOCK_EX);
        break;
}

// Return success response
http_response_code(200);
echo json_encode(['status' => 'success', 'event_processed' => $event_type]);

// Helper functions
function handleUserLogin($data) {
    $user_id = $data['user_id'] ?? null;
    $platform = $data['platform'] ?? 'unknown';
    
    $action_log = [
        'timestamp' => date('Y-m-d H:i:s'),
        'action' => 'handleUserLogin',
        'user_id' => $user_id,
        'platform' => $platform
    ];
    
    $action_log_file = __DIR__ . '/../logs/social_actions.log';
    file_put_contents($action_log_file, json_encode($action_log) . "\n", FILE_APPEND | LOCK_EX);
}

function handleTrackShared($data) {
    $user_id = $data['user_id'] ?? null;
    $track_id = $data['track_id'] ?? null;
    $platform = $data['platform'] ?? 'unknown';
    
    $action_log = [
        'timestamp' => date('Y-m-d H:i:s'),
        'action' => 'handleTrackShared',
        'user_id' => $user_id,
        'track_id' => $track_id,
        'platform' => $platform
    ];
    
    $action_log_file = __DIR__ . '/../logs/social_actions.log';
    file_put_contents($action_log_file, json_encode($action_log) . "\n", FILE_APPEND | LOCK_EX);
}

function handlePlaylistCreated($data) {
    $user_id = $data['user_id'] ?? null;
    $playlist_id = $data['playlist_id'] ?? null;
    $playlist_name = $data['playlist_name'] ?? 'Unknown';
    
    $action_log = [
        'timestamp' => date('Y-m-d H:i:s'),
        'action' => 'handlePlaylistCreated',
        'user_id' => $user_id,
        'playlist_id' => $playlist_id,
        'playlist_name' => $playlist_name
    ];
    
    $action_log_file = __DIR__ . '/../logs/social_actions.log';
    file_put_contents($action_log_file, json_encode($action_log) . "\n", FILE_APPEND | LOCK_EX);
}

function handleCommentPosted($data) {
    $user_id = $data['user_id'] ?? null;
    $track_id = $data['track_id'] ?? null;
    $comment_id = $data['comment_id'] ?? null;
    $comment_text = $data['comment_text'] ?? '';
    
    $action_log = [
        'timestamp' => date('Y-m-d H:i:s'),
        'action' => 'handleCommentPosted',
        'user_id' => $user_id,
        'track_id' => $track_id,
        'comment_id' => $comment_id,
        'comment_text' => substr($comment_text, 0, 100) // Truncate for logging
    ];
    
    $action_log_file = __DIR__ . '/../logs/social_actions.log';
    file_put_contents($action_log_file, json_encode($action_log) . "\n", FILE_APPEND | LOCK_EX);
}

function handleLikeAdded($data) {
    $user_id = $data['user_id'] ?? null;
    $track_id = $data['track_id'] ?? null;
    $like_type = $data['like_type'] ?? 'track';
    
    $action_log = [
        'timestamp' => date('Y-m-d H:i:s'),
        'action' => 'handleLikeAdded',
        'user_id' => $user_id,
        'track_id' => $track_id,
        'like_type' => $like_type
    ];
    
    $action_log_file = __DIR__ . '/../logs/social_actions.log';
    file_put_contents($action_log_file, json_encode($action_log) . "\n", FILE_APPEND | LOCK_EX);
}
?> 

CasperSecurity Mini