Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
10cb7594d7
85
enter.php
85
enter.php
@ -11,46 +11,67 @@ $password = filter_input(INPUT_POST, 'password');
|
|||||||
$battle = filter_input(INPUT_COOKIE, 'battle');
|
$battle = filter_input(INPUT_COOKIE, 'battle');
|
||||||
$error = "";
|
$error = "";
|
||||||
|
|
||||||
$data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s" AND `pass` = "?s" LIMIT 1', $username, md5($password))->fetch_assoc();
|
if ($username && $password) {
|
||||||
|
$data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s"', $username)->fetch_assoc();
|
||||||
|
|
||||||
if (!$data['id']) {
|
if (!$data['id']) {
|
||||||
$error = 'Неверные учётные данные!';
|
$error = 'Ой! Такого пользователя нет!';
|
||||||
} elseif ($data['block'] == 1) {
|
} elseif ($data['block'] == 1) {
|
||||||
$error = 'Ваш персонаж был заблокирован!';
|
$error = 'Ой! Вы заблокированы!';
|
||||||
|
} elseif (password_verify($password, $data['pass'])) {
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
if ($battle != null && $data['id'] != $battle) {
|
||||||
|
db::c()->query('INSERT INTO `delo_multi` (`idperslater`, `idpersnow`) VALUES (?i, ?i)', $battle, $data['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
setcookie("battle", $data['id']);
|
||||||
|
$_SESSION['uid'] = $data['id'];
|
||||||
|
setcookie("uid", $data['id'], time() + 43200, "/", GAMEDOMAIN);
|
||||||
|
setcookie("hashcode", md5($data['id'] . $data["pass"] . $data["login"]), time() + 43200, "/", GAMEDOMAIN);
|
||||||
|
$_SESSION['sid'] = session_id();
|
||||||
|
|
||||||
|
$onl = db::c()->query('SELECT `id` FROM `online` WHERE `id` = "?s" LIMIT 1', $data['id'])->fetch_assoc();
|
||||||
|
if (isset($onl['id'])) {
|
||||||
|
db::c()->query('UPDATE `online` SET `date` = ?i WHERE `id` = "?s"', time(), $data['id']);
|
||||||
|
} else {
|
||||||
|
db::c()->query('INSERT INTO `online` (`id`, `date`, `room`) VALUES (?i, ?i, ?i)', $data['id'], time(), $data['room']);
|
||||||
|
}
|
||||||
|
|
||||||
|
db::c()->query('UPDATE `users` SET `sid` = "?s", `enter_game` = ?i WHERE `id` = ?i LIMIT 1', session_id(), 1, $data['id']);
|
||||||
|
$_SESSION['sid'] = session_id();
|
||||||
|
|
||||||
|
//TODO Лог IP адресов планировался удаляться из проекта.
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
db::c()->query('INSERT INTO `iplog` (`owner`, `ip`, `date`) VALUES (?i, "?s", ?i)', $data['id'], $ip, time());
|
||||||
|
|
||||||
|
$rs = db::c()->query('SELECT * FROM `telegraph` WHERE `owner` = ?i', $data['id']);
|
||||||
|
while ($res = $rs->fetch_assoc()) {
|
||||||
|
addchp($res['text'], '{[]}' . $data['login'] . '{[]}');
|
||||||
|
}
|
||||||
|
db::c()->query('DELETE FROM `telegraph` WHERE `owner` = ?i', $data['id']);
|
||||||
|
header("Location: fight.php");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
/**
|
||||||
if ($battle != null && $data['id'] != $battle) {
|
* Обновляем пароли пользователей...
|
||||||
db::c()->query('INSERT INTO `delo_multi` (`idperslater`, `idpersnow`) VALUES (?i, ?i)', $battle, $data['id']);
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
setcookie("battle", $data['id']);
|
$username_upd = filter_input(INPUT_POST, 'username_upd', FILTER_SANITIZE_SPECIAL_CHARS);
|
||||||
$_SESSION['uid'] = $data['id'];
|
$password_upd = filter_input(INPUT_POST, 'password_upd');
|
||||||
setcookie("uid", $data['id'], time() + 43200, "/", GAMEDOMAIN);
|
|
||||||
setcookie("hashcode", md5($data['id'] . $data["pass"] . $data["login"]), time() + 43200, "/", GAMEDOMAIN);
|
|
||||||
$_SESSION['sid'] = session_id();
|
|
||||||
|
|
||||||
$onl = db::c()->query('SELECT `id` FROM `online` WHERE `id` = "?s" LIMIT 1', $data['id'])->fetch_assoc();
|
if ($username_upd && $password_upd) {
|
||||||
if (isset($onl['id'])) {
|
$data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s" AND `pass` = "?s"', $username_upd, md5($password_upd))->fetch_assoc();
|
||||||
db::c()->query('UPDATE `online` SET `date` = ?i WHERE `id` = "?s"', time(), $data['id']);
|
if ($data['id']) {
|
||||||
|
db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `login` = "?s"', password_hash($password_upd, PASSWORD_DEFAULT), $username_upd);
|
||||||
|
header("Location: index.php");
|
||||||
} else {
|
} else {
|
||||||
db::c()->query('INSERT INTO `online` (`id`, `date`, `room`) VALUES (?i, ?i, ?i)', $data['id'], time(), $data['room']);
|
$error = 'Ошибка!';
|
||||||
}
|
}
|
||||||
|
|
||||||
db::c()->query('UPDATE `users` SET `sid` = "?s", `enter_game` = ?i WHERE `id` = ?i LIMIT 1', session_id(), 1, $data['id']);
|
|
||||||
$_SESSION['sid'] = session_id();
|
|
||||||
|
|
||||||
//TODO Лог IP адресов планировался удаляться из проекта.
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
|
||||||
db::c()->query('INSERT INTO `iplog` (`owner`, `ip`, `date`) VALUES (?i, "?s", ?i)', $data['id'], $ip, time());
|
|
||||||
|
|
||||||
$rs = db::c()->query('SELECT * FROM `telegraph` WHERE `owner` = ?i', $data['id']);
|
|
||||||
while ($res = $rs->fetch_assoc()) {
|
|
||||||
addchp($res['text'], '{[]}' . $data['login'] . '{[]}');
|
|
||||||
}
|
|
||||||
db::c()->query('DELETE FROM `telegraph` WHERE `owner` = ?i', $data['id']);
|
|
||||||
header("Location: fight.php");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
|
10
index.php
10
index.php
@ -17,6 +17,16 @@
|
|||||||
<input type=submit value='Отправить'>
|
<input type=submit value='Отправить'>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div style="background: seashell; border-radius: 5px; margin-top: 10px; padding: 10px; display: inline-block;">
|
||||||
|
<form method="post" action="enter.php">
|
||||||
|
Обновление пароля<br>
|
||||||
|
<input name='username_upd' placeholder='Логин'>
|
||||||
|
<input name='password_upd' placeholder='Пароль' type="password">
|
||||||
|
<input type=submit value='Отправить'>
|
||||||
|
</form>
|
||||||
|
<p>Если не пускает внутрь, обнови пароль!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
<li><a href="register.php">Регистрация</a></li>
|
<li><a href="register.php">Регистрация</a></li>
|
||||||
<li><a href="rememberpassword.php">Забыли пароль?</a></li>
|
<li><a href="rememberpassword.php">Забыли пароль?</a></li>
|
||||||
|
@ -4,7 +4,8 @@ if(!isset($_SESSION['uid'])) header("Location: index.php");
|
|||||||
include("config.php");
|
include("config.php");
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
if($user['in_tower'] == 1) { header('Location: towerin.php'); die(); }
|
if($user['in_tower'] == 1) { header('Location: towerin.php'); die(); }
|
||||||
$al = mysql_fetch_assoc(mysql_query("SELECT * FROM `aligns` WHERE `align` = '{$user['align']}' LIMIT 1"));
|
//$al = mysql_fetch_assoc(mysql_query("SELECT * FROM `aligns` WHERE `align` = '{$user['align']}' LIMIT 1"));
|
||||||
|
$al = db::c()->query('SELECT `accses`,`name` FROM `aligns` WHERE `align` = ?i', $user['align'])->fetch_assoc();
|
||||||
header("Cache-Control: no-cache");
|
header("Cache-Control: no-cache");
|
||||||
|
|
||||||
# Защита для свитков.
|
# Защита для свитков.
|
||||||
@ -28,9 +29,9 @@ $arr = array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<!doctype html>
|
||||||
<HTML>
|
<html>
|
||||||
<HEAD>
|
<head>
|
||||||
<link rel=stylesheet href="css/main.css">
|
<link rel=stylesheet href="css/main.css">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<style>
|
<style>
|
||||||
|
Loading…
Reference in New Issue
Block a user