Хренение имени получателя в сессии, чтобы избежать разлогина.

This commit is contained in:
lopar 2018-06-24 13:18:49 +03:00
parent 3e3d8aceb0
commit dfd2ea5ab0

View File

@ -13,14 +13,17 @@ if ($user['battle'] != 0) {
die();
}
$changeReceiver = filter_input(INPUT_GET,'change');
if ($changeReceiver) unset($_SESSION['receiverName']);
$razdelId = filter_input(INPUT_GET, 'razdel');
$receiverName = filter_input(INPUT_POST, 'receiverName');
$_SESSION['receiverName'] = filter_input(INPUT_POST, 'receiverName');
$receiverId = null;
$queryItems = null;
$allowOperations = false;
if ($receiverName) {
$receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $receiverName)->fetch_assoc();
if ($_SESSION['receiverName']) {
$receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $_SESSION['receiverName'])->fetch_assoc();
if (!$receiver['id']) err('Персонажа не существует!');
elseif ($receiver['level'] < 4) err('Персонажей ниже 4-го уровня не обслуживаем!');
else {
@ -79,7 +82,7 @@ if ($receiverName) {
<a href=# onclick=leave()> ← выйти на Центральную площадь</a>
<br>
<?php if (true == $allowOperations): ?>
Получатель: <?= nick::id($receiverId)->full() ?>
Получатель: <?= nick::id($_SESSION['receiverName'])->full() ?>
<a href="?change">Сменить</a>
<table width=100%>
<tr>
@ -105,7 +108,7 @@ if ($receiverName) {
<td align=center>
<IMG SRC="i/sh/<?= $row['img'] ?>" BORDER=0>";
<BR>
<a href="post.php?to_id=<?= $receiverId ?>&id_th=<?= $row['id'] ?>&setobject=<?= $row['id'] ?>&sd4=<?= $user['id'] ?>&rnd=<?= mt_rand() ?>"
<a href="post.php?to_id=<?= $_SESSION['receiverName'] ?>&id_th=<?= $row['id'] ?>&setobject=<?= $row['id'] ?>&sd4=<?= $user['id'] ?>&rnd=<?= mt_rand() ?>"
onclick="return confirm('Передать предмет<?= $row['name'] ?>?')">передать&nbsp;за&nbsp;1&nbsp;кр.</a>
</td>
<td valign=top>