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/import_track.php
<?php
// Import track from API.Box
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'config/database.php';

header('Content-Type: application/json');

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    echo json_encode(['error' => 'Method not allowed']);
    exit;
}

$input = json_decode(file_get_contents('php://input'), true);
$task_id = $input['task_id'] ?? null;

if (!$task_id) {
    http_response_code(400);
    echo json_encode(['error' => 'Task ID required']);
    exit;
}

$pdo = getDBConnection();
if (!$pdo) {
    http_response_code(500);
    echo json_encode(['error' => 'Database connection failed']);
    exit;
}

// Check if track already exists
$stmt = $pdo->prepare("SELECT id FROM music_tracks WHERE task_id = ?");
$stmt->execute([$task_id]);
if ($stmt->fetch()) {
    echo json_encode(['error' => 'Track already exists in database']);
    exit;
}

// Get API.Box track details
$api_key = '63edba40620216c5aa2c04240ac41dbd';
$api_url = "https://api.api.box/api/v1/status/$task_id";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $api_key,
    'Content-Type: application/json',
    'User-Agent: SoundStudioPro-Import/1.0'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code !== 200) {
    echo json_encode(['error' => 'API.Box returned HTTP ' . $http_code]);
    exit;
}

$api_data = json_decode($response, true);

if (!$api_data) {
    echo json_encode(['error' => 'Invalid response from API.Box']);
    exit;
}

// Extract track information
$status = 'processing';
$audio_url = null;
$title = 'Imported Track';
$prompt = 'Imported from API.Box';

if (isset($api_data['data']['status'])) {
    $status = $api_data['data']['status'] === 'complete' ? 'complete' : 
              ($api_data['data']['status'] === 'failed' ? 'failed' : 'processing');
}

if (isset($api_data['data']['audioUrl'])) {
    $audio_url = $api_data['data']['audioUrl'];
}

if (isset($api_data['data']['title'])) {
    $title = $api_data['data']['title'];
}

if (isset($api_data['data']['prompt'])) {
    $prompt = $api_data['data']['prompt'];
}

// For now, assign to the first user (you might want to implement user detection logic)
$stmt = $pdo->prepare("SELECT id FROM users ORDER BY id LIMIT 1");
$stmt->execute();
$user = $stmt->fetch();

if (!$user) {
    echo json_encode(['error' => 'No users found in database']);
    exit;
}

// Create metadata
$metadata = json_encode([
    'imported' => true,
    'imported_at' => date('Y-m-d H:i:s'),
    'api_data' => $api_data
]);

// Insert track
$stmt = $pdo->prepare("
    INSERT INTO music_tracks (user_id, task_id, title, prompt, music_type, status, audio_url, metadata, created_at) 
    VALUES (?, ?, ?, ?, 'music', ?, ?, ?, NOW())
");

if ($stmt->execute([$user['id'], $task_id, $title, $prompt, $status, $audio_url, $metadata])) {
    $track_id = $pdo->lastInsertId();
    
    echo json_encode([
        'success' => true,
        'message' => 'Track imported successfully',
        'data' => [
            'track_id' => $track_id,
            'task_id' => $task_id,
            'title' => $title,
            'status' => $status,
            'audio_url' => $audio_url,
            'user_id' => $user['id']
        ]
    ]);
} else {
    echo json_encode(['error' => 'Failed to insert track into database']);
}
?> 

CasperSecurity Mini