Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f519644898
28
enter.php
28
enter.php
@ -12,34 +12,34 @@ $battle = $_COOKIE['battle'] ?? '';
|
|||||||
$error = "";
|
$error = "";
|
||||||
|
|
||||||
if ($username && $password) {
|
if ($username && $password) {
|
||||||
$data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s"', $username)->fetch_assoc();
|
$user_query = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s"', $username)->fetch_assoc();
|
||||||
|
|
||||||
if (!$data['id']) {
|
if (!$user_query['id']) {
|
||||||
$error = 'Ой! Такого пользователя нет!';
|
$error = 'Ой! Такого пользователя нет!';
|
||||||
} elseif ($data['block'] == 1) {
|
} elseif ($user_query['block'] == 1) {
|
||||||
$error = 'Ой! Вы заблокированы!';
|
$error = 'Ой! Вы заблокированы!';
|
||||||
} elseif (password_verify($password, $data['pass'])) {
|
} elseif (password_verify($password, $user_query['pass'])) {
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
# Проверка на мультоводство по используемому кукису.
|
# Проверка на мультоводство по используемому кукису.
|
||||||
if ($battle != null && $data['id'] != $battle) {
|
if ($battle != null && $user_query['id'] != $battle) {
|
||||||
db::c()->query('INSERT INTO log_multiaccounts (older_data, current_data) VALUES (?i, ?i)', $battle, $data['id']);
|
db::c()->query('INSERT INTO users_logs (user_id, type, text) VALUES (?i, "?s", "?s")', $user_query['id'], "multiaccounts", "Разные ID на входе. Возможно используются несколько аккаунтов.");
|
||||||
}
|
}
|
||||||
|
|
||||||
setcookie("battle", $data['id']);
|
setcookie("battle", $user_query['id']);
|
||||||
$_SESSION['uid'] = $data['id'];
|
$_SESSION['uid'] = $user_query['id'];
|
||||||
setcookie("uid", $data['id'], time() + 43200, "/", GAMEDOMAIN);
|
setcookie("uid", $user_query['id'], time() + 43200, "/", GAMEDOMAIN);
|
||||||
setcookie("hashcode", md5($data['id'] . $data["pass"] . $data["login"]), time() + 43200, "/", GAMEDOMAIN);
|
setcookie("hashcode", md5($user_query['id'] . $user_query["pass"] . $user_query["login"]), time() + 43200, "/", GAMEDOMAIN);
|
||||||
$_SESSION['sid'] = session_id();
|
$_SESSION['sid'] = session_id();
|
||||||
|
|
||||||
$onl = db::c()->query('SELECT user_id FROM online WHERE user_id = "?s"', $data['id'])->fetch_assoc();
|
$onl = db::c()->query('SELECT user_id FROM online WHERE user_id = "?s"', $user_query['id'])->fetch_assoc();
|
||||||
if (isset($onl['user_id'])) {
|
if (isset($onl['user_id'])) {
|
||||||
db::c()->query('UPDATE online SET date = ?i WHERE user_id = "?s"', time(), $data['id']);
|
db::c()->query('UPDATE online SET date = ?i WHERE user_id = "?s"', time(), $user_query['id']);
|
||||||
} else {
|
} else {
|
||||||
db::c()->query('INSERT INTO online (user_id, date, room) VALUES (?i, ?i, ?i)', $data['id'], time(), $data['room']);
|
db::c()->query('INSERT INTO online (user_id, date, room) VALUES (?i, ?i, ?i)', $user_query['id'], time(), $user_query['room']);
|
||||||
}
|
}
|
||||||
|
|
||||||
db::c()->query('UPDATE `users` SET `session_id` = "?s", `enter_game` = ?i WHERE `id` = ?i', session_id(), 1, $data['id']);
|
db::c()->query('UPDATE `users` SET `session_id` = "?s", `enter_game` = ?i WHERE `id` = ?i', session_id(), 1, $user_query['id']);
|
||||||
// DEPRECATED. NO TABLE IN DB!
|
// DEPRECATED. NO TABLE IN DB!
|
||||||
// $sms = db::c()->query('SELECT * FROM `telegraph` WHERE `receiver` = ?i', $data['id']);
|
// $sms = db::c()->query('SELECT * FROM `telegraph` WHERE `receiver` = ?i', $data['id']);
|
||||||
// while ($res = $sms->fetch_assoc()) {
|
// while ($res = $sms->fetch_assoc()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user