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

$status = false;

$new_data = array(
    'property_id' => $_REQUEST['property_id'],
    'status' => $_REQUEST['status'],
    'event_date' => $_REQUEST['event_date'],
    'unit' => $_REQUEST['unit'],
    'type' => $_REQUEST['type'],
    'amount' => $_REQUEST['amount'],
    'quotation_file' => serialize($_REQUEST['quotation_file']),
    'adjuster_file' => serialize($_REQUEST['adjuster_file']),
    'insurance_file' => serialize($_REQUEST['insurance_file']),
    'remarks' => $_REQUEST['remarks'],
    'ref'   => $_REQUEST['ref'],
    'wr2'   => $_REQUEST['wr2'],
    'event_end_date' => $_REQUEST['event_end_date']
);

$status = $wpdb->insert("keylab_property_insurance_claims", $new_data, array(
    "%d", 
    "%s", "%s", "%s", "%s",
    "%s", "%s", "%s", "%s","%s", "%s", "%s", "%s"
));
$sql = $wpdb->last_query;
$log_id = $wpdb->insert_id;

//修改ref
$statement = "SELECT insurance_claims_id, ref FROM keylab_property_insurance_claims WHERE ref = ''";
$results = $wpdb->get_results($statement);

foreach($results as $value){
    $wpdb->update("keylab_property_insurance_claims",[
        'ref' => '#'.$value->insurance_claims_id
    ], [
        'insurance_claims_id' => $value->insurance_claims_id
    ]);
}

if ($status === false) {
    $rv->status = false;
    $rv->error = $wpdb->last_error;
} else {
    $rv->status = true;

$a_new_quotation_file = $_REQUEST['quotation_file'];
$a_new_adjuster_file = $_REQUEST['adjuster_file'];
$a_new_insurance_file = $_REQUEST['insurance_file'];

foreach($a_new_quotation_file as $key=>$value){
	update_post_meta($value['uid'], 'in_use', 1);
}
foreach($a_new_adjuster_file as $key=>$value){
	update_post_meta($value['uid'], 'in_use', 1);
}
foreach($a_new_insurance_file as $key=>$value){
	update_post_meta($value['uid'], 'in_use', 1);
}


}
    $rv->wpdb = $wpdb;

//log
keylab_data_log_by_user2($status, false, $new_data, $sql, "keylab_property_insurance_claims",$log_id);


exit(json_encode($rv));


?>