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/doco/keytest/wp-content/themes/ormedia/keylabData/oc/c_oc.php
<?php
if (isset($_REQUEST['checking_api_file'])) {
    exit();
}

$status = false;

$version = $_REQUEST['version'];

$user_id = $_REQUEST['user_id'];

if ($version == 'v2') {
    $category_array = [
        'oc',
    ];
    if (isset($_REQUEST['category']) && in_array($_REQUEST['category'], $category_array)) {
        $category = $_REQUEST['category'];
        //keylab_users表的个数再加1
        $num = $wpdb->get_var("SELECT MAX(`index_id`) FROM `keylab_users` WHERE `category` = '$category'");
        $num = intval($num) + 1;
    }
    $new_data = array(
        'status' => $_REQUEST['status'],
        'index_id' => $num,
        'type' => $_REQUEST['type'],
        'category' => $_REQUEST['category'],
        'name_zh' => $_REQUEST['name_zh'],
        'name_en' => $_REQUEST['name_en'],
        'address_zh' => $_REQUEST['address_zh'],
        'address_en' => $_REQUEST['address_en'],
        'login_tel' => $_REQUEST['login_tel'],
        'backup_tel' => $_REQUEST['backup_tel'],
        'email' => $_REQUEST['email'],
        'fax' => $_REQUEST['fax'],
        'created_by' => $_REQUEST['created_by']
    );
    if (!empty($_REQUEST['property_id'])) {
        $new_data['custom_id'] = intval($_REQUEST['property_id']);
    }
    if (!empty($_REQUEST['position'])) {
        $new_data['position'] = $_REQUEST['position'];
    }
    if (!empty($_REQUEST['identity_card'])) {
        $new_data['identity_card'] = $_REQUEST['identity_card'];
    }
    //往keylab_users表中插入新的数据
    $status = $wpdb->insert("keylab_users", $new_data);
    $log_id = $wpdb->insert_id;//查询最后一条插入SQL语句的ID。
    if ($status != false) {
        $user_id = $log_id;
    } else {
        $rv->status = false;
        $rv->code = -4;
        $rv->error = $wpdb->last_error;
    }
}

$new_data = array(
    'property_id' => $_REQUEST['property_id'],
    'user_id' => $user_id,
    'year_from' => $_REQUEST['year_from'],
    'year_to' => $_REQUEST['year_to'],
    'term' => $_REQUEST['term'],
    'position' => $_REQUEST['position'],
    'elected_date' => $_REQUEST['elected_date'],
    'unit' => $_REQUEST['unit'],
    'oc_group' => $_REQUEST['oc_group'],
    'company_or_job' => $_REQUEST['company_or_job'],
    'remarks' => $_REQUEST['remarks'],
    'oc_file' => serialize($_REQUEST['oc_file']),
);
//往keylab_property_oc表中插入一条新的数据,insert后面的array为插入时的数据格式(string,int)
$status = $wpdb->insert("keylab_property_oc", $new_data, array(
    "%d", "%d",
    "%d", "%d", "%d", "%s", "%s", "%s", "%s"
));
$log_id = $wpdb->insert_id;


if ($status === false) {
    $rv->status = false;
    $rv->error = $wpdb->last_error;
} else {
    $rv->status = true;
}
//log
keylab_data_log_by_user2($status, false, $new_data, $wpdb->last_query, "keylab_property_oc", $log_id);


$rv->wpdb = $wpdb;
exit(json_encode($rv));