403Webshell
Server IP : 158.247.231.215  /  Your IP : 216.73.217.84
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux CTMS 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /mnt/blockstorage/ctms/api/custom-api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /mnt/blockstorage/ctms/api/custom-api/vr-version-list.php
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, OPTIONS');
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Authorization");
header('Content-Type: application/json');

if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
    http_response_code(200);
    exit();
}

// Load WordPress and auth helper
require_once('/mnt/blockstorage/ctms/wp-load.php');
require_once('auth-helper.php');

include('../database.php');

// Verify JWT token
$user_id = verify_jwt_token();

if (!$user_id) {
    send_error_response('User not authenticated', 401);
}

if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    try {
        $content_id = isset($_GET['content_id']) ? intval($_GET['content_id']) : 0;

        if ($content_id <= 0) {
            throw new Exception('Valid content_id is required');
        }

        // Check if content exists
        $check_sql = "SELECT id, title FROM vr_contents WHERE id = $content_id";
        $check_result = $conn->query($check_sql);

        if (!$check_result || $check_result->num_rows === 0) {
            throw new Exception('Content not found');
        }

        $content = $check_result->fetch_assoc();

        // Get versions
        $sql = "SELECT * FROM vr_content_versions
                WHERE content_id = $content_id
                ORDER BY created_at DESC";

        $result = $conn->query($sql);

        $versions = array();
        while ($row = $result->fetch_assoc()) {
            $pico_url = null;
            if ($row['pico_apk_path']) {
                $pico_url = 'https://training.contentsda.kr/vr-content-uploads/' . $row['pico_apk_path'];
            }

            $quest_url = null;
            if ($row['quest_apk_path']) {
                $quest_url = 'https://training.contentsda.kr/vr-content-uploads/' . $row['quest_apk_path'];
            }

            $versions[] = array(
                'id' => intval($row['id']),
                'version_number' => $row['version_number'],
                'pico_apk_url' => $pico_url,
                'pico_apk_size' => $row['pico_apk_size'] ? intval($row['pico_apk_size']) : null,
                'quest_apk_url' => $quest_url,
                'quest_apk_size' => $row['quest_apk_size'] ? intval($row['quest_apk_size']) : null,
                'release_notes' => $row['release_notes'],
                'status' => $row['status'],
                'created_at' => $row['created_at'],
                'updated_at' => $row['updated_at']
            );
        }

        $response = array(
            'status' => 'success',
            'data' => array(
                'content_id' => $content_id,
                'content_title' => $content['title'],
                'versions' => $versions,
                'total' => count($versions)
            )
        );

        echo json_encode($response);

    } catch (Exception $e) {
        $response = array(
            'status' => 'error',
            'message' => $e->getMessage()
        );
        http_response_code(400);
        echo json_encode($response);
    }

    $conn->close();

} else {
    $response = array(
        'status' => 'error',
        'message' => 'Only GET requests are allowed'
    );
    http_response_code(405);
    echo json_encode($response);
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit