} $stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET first_name= :first_name, last_name= :last_name, gender= :gender, birthday=' . $array_data['birthday'] . ', view_mail=' . $array_data['view_mail'] . ' WHERE userid=' . $user_info['userid']); $stmt->bindParam(':first_name', $array_data['first_name'], PDO::PARAM_STR); $stmt->bindParam(':last_name', $array_data['last_name'], PDO::PARAM_STR); $stmt->bindParam(':gender', $array_data['gender'], PDO::PARAM_STR); $stmt->execute(); die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=editinfo/basic', true), 'mess' => $lang_module['editinfo_ok']))); } elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'avatar') { } elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'username') { $nv_username = nv_substr($nv_Request->get_title('username', 'post', '', 1), 0, NV_UNICKMAX); $nv_password = $nv_Request->get_title('password', 'post', ''); if (empty($nv_password) or !$crypt->validate_password($nv_password, $row['password'])) { die(json_encode(array('status' => 'error', 'input' => 'password', 'mess' => $lang_global['incorrect_password']))); } if ($nv_username != $row['username']) { $checkusername = nv_check_username_change($nv_username); if (!empty($checkusername)) { die(json_encode(array('status' => 'error', 'input' => 'username', 'mess' => $checkusername))); } } $md5_username = nv_md5safe($nv_username); $stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET username= :username, md5username= :md5username WHERE userid=' . $user_info['userid']); $stmt->bindParam(':username', $nv_username, PDO::PARAM_STR); $stmt->bindParam(':md5username', $md5_username, PDO::PARAM_STR); $stmt->execute(); $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']); $name = array_filter($name); $name = implode(' ', $name); $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>'; $message = sprintf($lang_module['edit_mail_content'], $name, $sitename, $lang_global['username'], $nv_username); @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['edit_mail_subject'], $message);
$array_data['email'] = $row['email']; $array_data['allowmailchange'] = $global_config['allowmailchange']; $array_data['allowloginchange'] = ($global_config['allowloginchange'] or !empty($row['last_openid']) and empty($user_info['last_login']) and empty($user_info['last_agent']) and empty($user_info['last_ip']) and empty($user_info['last_openid'])) ? 1 : 0; if ($checkss == $array_data['checkss']) { $error = array(); $array_data['first_name'] = nv_substr($nv_Request->get_title('first_name', 'post', '', 1), 0, 255); $array_data['last_name'] = nv_substr($nv_Request->get_title('last_name', 'post', '', 1), 0, 255); $array_data['gender'] = nv_substr($nv_Request->get_title('gender', 'post', '', 1), 0, 1); $array_data['photo'] = nv_substr($nv_Request->get_title('avatar', 'post', '', 1), 0, 255); $array_data['birthday'] = nv_substr($nv_Request->get_title('birthday', 'post', '', 0), 0, 10); $array_data['view_mail'] = $nv_Request->get_int('view_mail', 'post', 0); $array_data['photo_delete'] = $nv_Request->get_int('photo_delete', 'post', 0); if ($array_data['allowloginchange']) { $array_data['username'] = nv_substr($nv_Request->get_title('username', 'post', '', 1), 0, NV_UNICKMAX); if ($array_data['username'] != $row['username']) { $checkusername = nv_check_username_change($array_data['username']); if ($checkusername != '') { $array_data['username'] = $row['username']; $error[] = $checkusername; } } } if (empty($array_data['first_name'])) { $array_data['first_name'] = $row['first_name']; $error[] = $lang_module['name']; if (empty($array_data['first_name'])) { $array_data['first_name'] = $row['username']; } } if ($array_data['gender'] != 'M' and $array_data['gender'] != 'F') { $array_data['gender'] = '';
$array_data['allowloginchange'] = ($global_config['allowloginchange'] or !empty($row['last_openid']) and empty($user_info['last_login']) and empty($user_info['last_agent']) and empty($user_info['last_ip']) and empty($user_info['last_openid'])) ? 1 : 0; if ($checkss == $array_data['checkss']) { $error = array(); $array_data['full_name'] = filter_text_input('full_name', 'post', '', 1, 255); $array_data['gender'] = filter_text_input('gender', 'post', '', 1, 1); $array_data['birthday'] = filter_text_input('birthday', 'post', '', 0, 10); $array_data['website'] = filter_text_input('website', 'post', '', 0, 255); $array_data['address'] = filter_text_input('address', 'post', '', 1, 255); $array_data['yim'] = filter_text_input('yim', 'post', '', 1, 100); $array_data['telephone'] = filter_text_input('telephone', 'post', '', 1, 100); $array_data['fax'] = filter_text_input('fax', 'post', '', 1, 100); $array_data['mobile'] = filter_text_input('mobile', 'post', '', 1, 100); $array_data['view_mail'] = $nv_Request->get_int('view_mail', 'post', 0); if ($array_data['allowloginchange']) { $array_data['username'] = filter_text_input('username', 'post', '', 1, NV_UNICKMAX); if (nv_check_username_change($array_data['username']) != "") { $array_data['username'] = $row['username']; $error[] = $lang_module['account']; } } if ($array_data['allowmailchange']) { $array_data['email'] = filter_text_input('email', 'post', '', 1, 100); if (nv_check_email_change($array_data['email']) != "") { $array_data['email'] = $row['email']; $error[] = $lang_module['email']; } } if (empty($array_data['full_name'])) { $array_data['full_name'] = $row['full_name']; $error[] = $lang_module['name']; if (empty($array_data['full_name'])) {
} $stmt = $db->prepare('UPDATE ' . NV_MOD_TABLE . ' SET first_name= :first_name, last_name= :last_name, gender= :gender, birthday=' . $array_data['birthday'] . ', view_mail=' . $array_data['view_mail'] . ' WHERE userid=' . $edit_userid); $stmt->bindParam(':first_name', $array_data['first_name'], PDO::PARAM_STR); $stmt->bindParam(':last_name', $array_data['last_name'], PDO::PARAM_STR); $stmt->bindParam(':gender', $array_data['gender'], PDO::PARAM_STR); $stmt->execute(); die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite($base_url . '/basic', true), 'mess' => $lang_module['editinfo_ok']))); } elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'avatar') { } elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'username') { $nv_username = nv_substr($nv_Request->get_title('username', 'post', '', 1), 0, NV_UNICKMAX); $nv_password = $nv_Request->get_title('password', 'post', ''); if (empty($nv_password) or !$crypt->validate_password($nv_password, $row['password'])) { die(json_encode(array('status' => 'error', 'input' => 'password', 'mess' => $lang_global['incorrect_password']))); } if ($nv_username != $row['username']) { $checkusername = nv_check_username_change($nv_username, $edit_userid); if (!empty($checkusername)) { die(json_encode(array('status' => 'error', 'input' => 'username', 'mess' => $checkusername))); } } $md5_username = nv_md5safe($nv_username); $stmt = $db->prepare('UPDATE ' . NV_MOD_TABLE . ' SET username= :username, md5username= :md5username WHERE userid=' . $edit_userid); $stmt->bindParam(':username', $nv_username, PDO::PARAM_STR); $stmt->bindParam(':md5username', $md5_username, PDO::PARAM_STR); $stmt->execute(); $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']); $name = array_filter($name); $name = implode(' ', $name); $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>'; $message = sprintf($lang_module['edit_mail_content'], $name, $sitename, $lang_global['username'], $nv_username); @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['edit_mail_subject'], $message);