$success = $rDB->selectCell(' INSERT INTO account (username, sha_pass_hash, email, joindate, expansion, last_ip) VALUES (?, ?, ?, NOW(), ?, ?) ', $_POST['username'], create_usersend_pass($_POST['username'], $_POST['password']), isset($_POST['email']) ? $_POST['email'] : '', $AoWoWconf['expansion'], isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : ''); if ($success > 0) { // Все отлично, авторизуем $_REQUEST['account'] = 'signin'; } else { // Неизвестная ошибка $smarty->assign('signup_error', $smarty->get_config_vars('Unknow_error_on_account_create')); } } } } if ($_REQUEST['account'] == 'signin' && isset($_POST['username']) && isset($_POST['password'])) { $usersend_pass = create_usersend_pass($_POST['username'], $_POST['password']); $user = CheckPwd($_POST['username'], $usersend_pass); if ($user == -1) { del_user_cookie(); if (isset($_SESSION['username'])) { unset($_SESSION['username']); } $smarty->assign('signin_error', $smarty->get_config_vars('Such_user_doesnt_exists')); } elseif ($user == 0) { del_user_cookie(); if (isset($_SESSION['username'])) { unset($_SESSION['username']); } $smarty->assign('signin_error', $smarty->get_config_vars('Wrong_password')); } else { // Имя пользователя и пароль совпадают
*/ // Загружаем файл перевода для smarty $smarty->config_load($conf_file, 'account'); // Создание аккаунта if ($_REQUEST['account'] == 'signup' and isset($_POST['username']) and isset($_POST['password']) and isset($_POST['c_password']) and $UDWBaseconf['register'] == true) { // Совпадают ли введенные пароли? if ($_POST['password'] != $_POST['c_password']) { $smarty->assign('signup_error', $smarty->get_config_vars('Different_passwords')); } else { // Существует ли уже такой пользователь? if ($rDB->selectCell('SELECT Count(id) FROM ?_account WHERE username=? LIMIT 1', $_POST['username']) == 1) { $smarty->assign('signup_error', $smarty->get_config_vars('Such_user_exists')); } else { // Вроде все нормально, создаем аккаунт $success = $rDB->selectCell('INSERT INTO ?_account(`username`, `sha_pass_hash`, `email`, `joindate`, `expansion`, `last_ip`) VALUES (?, ?, ?, NOW(), ?, ?)', $_POST['username'], create_usersend_pass($_POST['username'], $_POST['password']), isset($_POST['email']) ? $_POST['email'] : '', $UDWBaseconf['expansion'], isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : ''); if ($success > 0) { // Все отлично, авторизуем $_REQUEST['account'] = 'signin'; } else { // Неизвестная ошибка $smarty->assign('signup_error', $smarty->get_config_vars('Unknow_error_on_account_create')); } } } } if ($_REQUEST['account'] == 'signin' and isset($_POST['username']) and isset($_POST['password'])) { //$usersend_pass = create_usersend_pass($_POST['username'], $_POST['password']); $shapass = $_POST['password']; $user = CheckPwd($_POST['username'], $shapass); if ($user == -1) {