File: /var/www/html/wp-content/themes/ormedia/keylabData/users/u_users.php
<?php
if (isset($_REQUEST['checking_api_file'])) {
exit();
}
$version = $_REQUEST['version'];
$old_data = $wpdb->get_results("select * from keylab_users where user_id = ".$_POST['user_id']);
$new_data = array(
'status' => $_REQUEST['status'],
'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'],
'status' => $_REQUEST['status'],
'login_tel' => $_REQUEST['login_tel'],
'backup_tel' => $_REQUEST['backup_tel'],
'email' => $_REQUEST['email'],
'fax' => $_REQUEST['fax'],
'created_by' => $_REQUEST['created_by']
);
if(!empty($_REQUEST['custom_id'])){
$new_data['custom_id'] = $_REQUEST['custom_id'];
}
if(!empty($_REQUEST['position'])){
$new_data['position'] = $_REQUEST['position'];
}
if(!empty($_REQUEST['identity_card'])){
$new_data['identity_card'] = $_REQUEST['identity_card'];
}
$rv->xx = $_REQUEST['login_tel'];
$status = false;
$status = $wpdb->update("keylab_users", $new_data, array('user_id' => $_POST['user_id']));
if(($_REQUEST['category'] == 'contractor'||$_REQUEST['category'] == 'propertyContractor') && $version == 'v2'){
update_users_meta($_POST['user_id'], 'contractor1_name', $_REQUEST['contractor1_name']);
update_users_meta($_POST['user_id'], 'contractor1_phone1', $_REQUEST['contractor1_phone1']);
update_users_meta($_POST['user_id'], 'contractor1_phone2', $_REQUEST['contractor1_phone2']);
update_users_meta($_POST['user_id'], 'contractor2_name', $_REQUEST['contractor2_name']);
update_users_meta($_POST['user_id'], 'contractor2_phone1', $_REQUEST['contractor2_phone1']);
update_users_meta($_POST['user_id'], 'contractor2_phone2', $_REQUEST['contractor2_phone2']);
update_users_meta($_POST['user_id'], 'card_file', serialize($_REQUEST['card_file']));
}
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_users", $_POST['user_id']);
exit(json_encode($rv));