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/notes/u_notes2.php
<?php
if (isset($_REQUEST['checking_api_file'])) {
    exit();
}
$old_data = $wpdb->get_results("select * from keylab_property_notes where note_id = ".$_POST['note_id']);
$new_data = array(
    'property_id' => $_REQUEST['property_id'],
    'title' => $_REQUEST['title'],
    'filing_date' => $_REQUEST['filing_date'],
    'content' => $_REQUEST['content'],
    'note_file' => serialize($_REQUEST['note_file']),
    'ref'   => $_REQUEST['ref']
);

$status = false;
$status = $wpdb->update("keylab_property_notes", $new_data, array('note_id' => $_POST['note_id']));
if ($status === false) {
    $rv->status = false;
    $rv->error = $wpdb->last_error;
} else {
    $rv->status = true;
}
    $rv->wpdb = $wpdb;

//log
keylab_data_log_by_user2($status, $old_data[0], $new_data, $wpdb->last_query, "keylab_property_notes", $_POST['note_id']);

$statement = "SELECT note_id, ref FROM keylab_property_notes WHERE ref = ''";
$results = $wpdb->get_results($statement);

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

exit(json_encode($rv));
?>