HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: 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,
Upload Files
File: /var/www/dk/wp-content/themes/food/page-api-data.php
<?php
//Template Name: api-data

$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
// ini_set('display_errors', 1);
$allow_origin = array(
    'http://120.79.165.149/',
    'http://dk.smart1space.site/'
);

if (in_array($origin, $allow_origin)) {
    header('Access-Control-Allow-Origin:' . $origin);
}
header("Access-Control-Allow-Credentials:true");
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");


// require_once('JwtAuthClass.php');
// require_once('JwtAuth.php');
if (!function_exists("get_template_directory")) {
    function get_template_directory()
    {
    }
}
date_default_timezone_set('UTC');
$rv = new stdClass();
$rc = 0;
$res = "";
$isAi_output = false;
$dir = get_template_directory();
include $dir . '/api/global/global.php';

if (isset($_REQUEST['action'])) {
    $a = $_REQUEST['action'];
} else {
    $rc = 1;
}

if (isset($_REQUEST['module'])) {
    $c = $_REQUEST['module'];
} else {
    $rc = 1;
}
if ($rc != 0) {
    rt();
}

$file = $dir . '/api/' . $c . '/' . $a . '.php';

if (file_exists($file)) {
    global $wpdb;
    include $dir . '/api/' . $c . '/' . $a . '.php';
} else {
    $rc = 404;
}
rt();
function rt()
{
    global $rv;
    global $rc;
    global $res;
    global $error;
    global $isAi_output;

//    echo '$ai_output -> '.$ai_output;
    if($isAi_output){

    }else{
        $rv->res = $res;
        $rv->rc = $rc;
        $rv->msg = !empty($rv->msg) ? $rv->msg : $error[$rc];

        exit(json_encode($rv));
    }

}