mysql> SELECT `c`.`a_user_index`, `c`.`a_nas` + IFNULL(`s`.`sum`, 0)
FROM (
SELECT `a_user_idx`, SUM(`a_count`) AS `sum`
FROM `t_stash04`
GROUP BY `a_user_idx`
) AS `s`
RIGHT JOIN `t_characters` AS `c`
ON `c`.`a_user_index` = `s`.`a_user_idx`
->
$$('.convert-form-to-data').on('click', function(){
var login = $$('input[name="login"]').val(),
pass = $$('input[name="password"]').val(),
value;
if((login != '') || (pass != '')){
app.preloader.show();
app.request({
url: url_link + 'login.php',
dataType: 'json',
data: {login: login, pass: pass, auth: true},
method: "POST",
success: function(response) {
app.preloader.hide();
if(response['json'] == 'error'){
app.dialog.alert('Такого пользователя не существует.', 'Ошибка');
}else{
window.localStorage.setItem('auth', true);
window.localStorage.setItem('id', response['id']);
window.localStorage.setItem('login', response['login']);
window.localStorage.setItem('pass', response['pass']);
value = window.localStorage.getItem("login");
app.loginScreen.close('.login-screen');
home_load();
}
},
error: function(){
app.preloader.hide();
app.dialog.alert('Повторите попытку позже.', 'Ошибка подключения');
}
});
}else{
app.dialog.alert('Введите логин и пароль.', 'Заполните поля');
}
});