dbquery($query); $OptionsError = loca("OPTIONS_MSG_PASS"); // TODO: OPTIONS_MSG_UNSAFE, OPTIONS_MSG_SIMPLE Logout($GlobalUser['session']); } } else { if ($_POST['db_email'] !== $GlobalUser['pemail'] && $_POST['db_email'] !== "") { // Сменить адрес $email = $_POST['db_email']; if ($GlobalUser['password'] !== md5($_POST['db_password'] . $db_secret)) { $OptionsError = loca("OPTIONS_ERR_NEEDPASS"); } else { if (!isValidEmail($email)) { $OptionsError = loca("OPTIONS_ERR_EMAIL"); } else { if (IsEmailExist($email)) { $OptionsError = loca("OPTIONS_ERR_EMAILUSED"); } } } if ($OptionsError === "") { $ip = $_SERVER['REMOTE_ADDR']; $ack = md5(time() . $db_secret); $query = "UPDATE " . $db_prefix . "users SET validated = 0, validatemd = '" . $ack . "', email = '" . $email . "' WHERE player_id = " . intval($GlobalUser['player_id']); dbquery($query); AddChangeEmailEvent($GlobalUser['player_id']); if ($ip !== "127.0.0.1") { SendChangeMail($GlobalUser['oname'], $email, $GlobalUser['pemail'], $ack); } $GlobalUser['email'] = $email; $OptionsError = loca("OPTIONS_USER_EMAIL_TIP");
function ChangeEmail($name, $email) { global $db_prefix, $db_secret; $name = mb_strtolower($name, 'UTF-8'); $email = mb_strtolower($email, 'UTF-8'); if (IsEmailExist($uni, $email, $name)) { return 0; } $query = "UPDATE " . $db_prefix . "users SET email = '" . $email . "' WHERE name = '" . $name . "'"; dbquery($query); $ack = ChangeActivationCode($name); $query = "SELECT * FROM " . $db_prefix . "users WHERE name = '" . $name . "'"; $result = dbquery($query); $user = dbarray($result); SendChangeMail($user['oname'], $email, $user['pemail'], $ack); return 1; }
if ($now - $last < 10 * 60 && $ip !== "127.0.0.1") { $RegError = 108; } else { if (strlen($_POST['password']) < 8) { $RegError = 107; } else { if (mb_strlen($_POST['character']) < 3 || mb_strlen($_POST['character']) > 20 || preg_match('/[;,<>()\\`\\"\']/', $_POST['character'])) { $RegError = 103; } else { if (IsUserExist($_POST['character'])) { $RegError = 101; } else { if (!isValidEmail($_POST['email'])) { $RegError = 104; } else { if (IsEmailExist($_POST['email'])) { $RegError = 102; } else { $RegError = 0; } } } } } } if (!key_exists('ogamelang', $_COOKIE)) { $lang = "ru"; } else { $lang = $_COOKIE['ogamelang']; } // Если все параметры верные - создать нового пользователя и войти в игру.