@nv_sendmail($global_config['site_email'], $row['email'], $lang_module['edit_mail_subject'], $message); 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/username', true), 'mess' => $lang_module['editinfo_ok']))); } elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'email') { $nv_email = nv_strtolower(nv_substr($nv_Request->get_title('email', 'post', '', 1), 0, 100)); $nv_password = $nv_Request->get_title('password', 'post', ''); $nv_verikeysend = (int) $nv_Request->get_bool('vsend', 'post', false); if (empty($nv_password) or !$nv_Request->get_bool('verikey', 'session')) { $nv_verikeysend = 1; } if ($nv_email == $row['email']) { die(json_encode(array('status' => 'error', 'input' => 'email', 'mess' => $lang_module['email_not_change']))); } if (!empty($row['password']) and !$crypt->validate_password($nv_password, $row['password'])) { die(json_encode(array('status' => 'error', 'input' => 'password', 'mess' => $lang_global['incorrect_password']))); } $checkemail = nv_check_email_change($nv_email); if (!empty($checkemail)) { die(json_encode(array('status' => 'error', 'input' => 'email', 'mess' => $checkemail))); } if ($nv_verikeysend) { $p = 0; $verikey = ''; if ($nv_Request->get_bool('verikey', 'session')) { $ss_verifykey = $nv_Request->get_title('verikey', 'session', ''); $ss_verifykey = explode('|', $ss_verifykey); if ((int) $ss_verifykey[0] > NV_CURRENTTIME) { die(json_encode(array('status' => 'error', 'input' => 'verifykey', 'mess' => sprintf($lang_module['verifykey_issend'], ceil(((int) $ss_verifykey[0] - NV_CURRENTTIME) / 60))))); } else { $p = (int) $ss_verifykey[1]; $verikey = $ss_verifykey[2]; $nv_Request->set_Session('verikey', NV_CURRENTTIME + 300 . '|' . $p . '|' . $verikey);
if ($array_data['gender'] == 'N') { $array_data['gender'] = ''; } if ($array_data['view_mail'] != 1) { $array_data['view_mail'] = 0; } if ($array_data['allowmailchange']) { $email_new = nv_substr($nv_Request->get_title('email', 'post', '', 1), 0, 100); if ($email_new != $row['email']) { $checknum = nv_genpass(10); $checknum = md5($checknum . $email_new); $md5_username = nv_md5safe($array_data['username']); $stmt = $db->prepare('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE md5username= :md5username'); $stmt->bindParam(':md5username', $md5username, PDO::PARAM_STR); $stmt->execute(); $error_email_change = nv_check_email_change($email_new); if (!empty($error_email_change)) { $error[] = $error_email_change; } else { $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . "_reg (username, md5username, password, email, first_name, last_name, regdate, question, answer, checknum, users_info) VALUES (\n\t\t\t\t\t'CHANGE_EMAIL_USERID_" . $user_info['userid'] . "',\n\t\t\t\t\t:md5_username,\n\t\t\t\t\t'',\n\t\t\t\t\t:email_new,\n\t\t\t\t\t'',\n\t\t\t\t\t'',\n\t\t\t\t\t" . NV_CURRENTTIME . ",\n\t\t\t\t\t'',\n\t\t\t\t\t'',\n\t\t\t\t\t:checknum,\n\t\t\t\t\t'' )"; $data_insert = array(); $data_insert['md5_username'] = $md5_username; $data_insert['email_new'] = $email_new; $data_insert['checknum'] = $checknum; $userid_check = $db->insert_id($sql, 'userid', $data_insert); if ($userid_check > 0) { $subject = $lang_module['email_active']; $message = sprintf($lang_module['email_active_info'], $array_data['first_name'], $array_data['username'], NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=active&userid=" . $userid_check . "&checknum=" . $checknum, nv_date("H:i d/m/Y", NV_CURRENTTIME + 86400), $global_config['site_name']); $send = nv_sendmail($global_config['site_email'], $email_new, $subject, $message); if ($send) { $error[] = $lang_module['email_active_mes'];
$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'])) { $array_data['full_name'] = $row['username']; } } if ($array_data['gender'] != "M" and $array_data['gender'] != "F") { $array_data['gender'] = ""; } if (preg_match("/^([0-9]{1,2})\\.([0-9]{1,2})\\.([0-9]{4})\$/", $array_data['birthday'])) {
@nv_sendmail($global_config['site_email'], $row['email'], $lang_module['edit_mail_subject'], $message); die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite($base_url . '/username', true), 'mess' => $lang_module['editinfo_ok']))); } elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'email') { $nv_email = nv_strtolower(nv_substr($nv_Request->get_title('email', 'post', '', 1), 0, 100)); $nv_password = $nv_Request->get_title('password', 'post', ''); $nv_verikeysend = (int) $nv_Request->get_bool('vsend', 'post', false); if (empty($nv_password) or !$nv_Request->get_bool('verikey', 'session')) { $nv_verikeysend = 1; } if ($nv_email == $row['email']) { die(json_encode(array('status' => 'error', 'input' => 'email', 'mess' => $lang_module['email_not_change']))); } if (!empty($row['password']) and !$crypt->validate_password($nv_password, $row['password'])) { die(json_encode(array('status' => 'error', 'input' => 'password', 'mess' => $lang_global['incorrect_password']))); } $checkemail = nv_check_email_change($nv_email, $edit_userid); if (!empty($checkemail)) { die(json_encode(array('status' => 'error', 'input' => 'email', 'mess' => $checkemail))); } if ($nv_verikeysend) { $p = 0; $verikey = ''; if ($nv_Request->get_bool('verikey', 'session')) { $ss_verifykey = $nv_Request->get_title('verikey', 'session', ''); $ss_verifykey = explode('|', $ss_verifykey); if ((int) $ss_verifykey[0] > NV_CURRENTTIME) { die(json_encode(array('status' => 'error', 'input' => 'verifykey', 'mess' => sprintf($lang_module['verifykey_issend'], ceil(((int) $ss_verifykey[0] - NV_CURRENTTIME) / 60))))); } else { $p = (int) $ss_verifykey[1]; $verikey = $ss_verifykey[2]; $nv_Request->set_Session('verikey', NV_CURRENTTIME + 300 . '|' . $p . '|' . $verikey);