Ремонт почты
This commit is contained in:
parent
236631222b
commit
54dd762aa1
20
css/main.css
20
css/main.css
@ -9,13 +9,13 @@ BODY {
|
|||||||
COLOR: #000000;
|
COLOR: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
H1,H2,H3,H4,H5,H6 {
|
H1, H2, H3, H4, H5, H6 {
|
||||||
FONT-WEIGHT: bold;
|
FONT-WEIGHT: bold;
|
||||||
COLOR: #8f0000;
|
COLOR: #8f0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
H3 {
|
H3 {
|
||||||
TEXT-ALIGN: center
|
TEXT-ALIGN: center
|
||||||
}
|
}
|
||||||
|
|
||||||
A, A:visited {
|
A, A:visited {
|
||||||
@ -48,7 +48,7 @@ A:hover {
|
|||||||
COLOR: #b00000;
|
COLOR: #b00000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.private, A.private, A.private:hover, A.private:visited, A.private:active{
|
.private, A.private, A.private:hover, A.private:visited, A.private:active {
|
||||||
FONT-WEIGHT: bold;
|
FONT-WEIGHT: bold;
|
||||||
COLOR: red;
|
COLOR: red;
|
||||||
BACKGROUND-COLOR: #fae0e0
|
BACKGROUND-COLOR: #fae0e0
|
||||||
@ -1000,6 +1000,7 @@ table.adm {
|
|||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.adm th {
|
table.adm th {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
@ -1007,19 +1008,28 @@ table.adm th {
|
|||||||
padding: 10px 8px;
|
padding: 10px 8px;
|
||||||
border-bottom: 2px solid #6678b1;
|
border-bottom: 2px solid #6678b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.adm td {
|
table.adm td {
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
color: #669;
|
color: #669;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
}
|
}
|
||||||
table.adm tbody tr:hover td
|
|
||||||
{
|
table.adm tbody tr:hover td {
|
||||||
color: #009;
|
color: #009;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.zebra tr {
|
table.zebra tr {
|
||||||
background-color: #C7C7C7;
|
background-color: #C7C7C7;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.zebra tr:nth-child(even) {
|
table.zebra tr:nth-child(even) {
|
||||||
background-color: #D5D5D5;
|
background-color: #D5D5D5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
color: dimgray;
|
||||||
|
font-family: consolas, sans-serif;
|
||||||
|
font-size: 18px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
@ -11,8 +11,7 @@ require_once 'config.php';
|
|||||||
* Класс-заглушка для работы глобальных переменных в функциях.
|
* Класс-заглушка для работы глобальных переменных в функциях.
|
||||||
* Возвращает массив данных таблицы users.
|
* Возвращает массив данных таблицы users.
|
||||||
*/
|
*/
|
||||||
$u = new users_row($_SESSION['uid']);
|
$user = (new users_row($_SESSION['uid']))->result();
|
||||||
$user = $u->result();
|
|
||||||
|
|
||||||
if (isset($user['id']) && $user['block'] == 1) {
|
if (isset($user['id']) && $user['block'] == 1) {
|
||||||
die();
|
die();
|
||||||
|
67
post.php
67
post.php
@ -13,7 +13,7 @@ if ($user['battle'] != 0) {
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$changeReceiver = filter_input(INPUT_GET,'change');
|
$changeReceiver = filter_input(INPUT_GET, 'change');
|
||||||
if ($changeReceiver) unset($_SESSION['receiverName']);
|
if ($changeReceiver) unset($_SESSION['receiverName']);
|
||||||
|
|
||||||
$razdelId = filter_input(INPUT_GET, 'razdel');
|
$razdelId = filter_input(INPUT_GET, 'razdel');
|
||||||
@ -23,12 +23,16 @@ $queryItems = null;
|
|||||||
|
|
||||||
if ($_SESSION['receiverName']) {
|
if ($_SESSION['receiverName']) {
|
||||||
$receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $_SESSION['receiverName'])->fetch_assoc();
|
$receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $_SESSION['receiverName'])->fetch_assoc();
|
||||||
if (!$receiver['id']) err('Персонажа не существует!');
|
if (!$receiver['id']) {
|
||||||
elseif ($receiver['level'] < 4) err('Персонажей ниже 4-го уровня не обслуживаем!');
|
err('Персонажа не существует!');
|
||||||
else {
|
unset($_SESSION['receiverName']);
|
||||||
$allowOperations = true;
|
} elseif ($receiver['level'] < 4) {
|
||||||
|
err('Персонажей ниже 4-го уровня не обслуживаем!');
|
||||||
|
unset($_SESSION['receiverName']);
|
||||||
|
} else {
|
||||||
$receiverId = $receiver['id'];
|
$receiverId = $receiver['id'];
|
||||||
$submit = filter_input(INPUT_POST, 'action');
|
$submit = filter_input(INPUT_POST, 'action');
|
||||||
|
$sendItemId = filter_input(INPUT_POST,'item_id');
|
||||||
$telegraphText = filter_input(INPUT_POST, 'message');
|
$telegraphText = filter_input(INPUT_POST, 'message');
|
||||||
|
|
||||||
if ($submit == 'sendMessage' && $telegraphText && $user['money'] >= 1) {
|
if ($submit == 'sendMessage' && $telegraphText && $user['money'] >= 1) {
|
||||||
@ -37,34 +41,25 @@ if ($_SESSION['receiverName']) {
|
|||||||
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
|
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
|
||||||
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, $telegraphText);
|
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, $telegraphText);
|
||||||
$statusMessage = 'Сообщение отправлено.';
|
$statusMessage = 'Сообщение отправлено.';
|
||||||
} else err('Сообщение было оставлено пустым!');
|
} else $statusMessage = 'Сообщение было оставлено пустым!';
|
||||||
} elseif ((is_numeric($_REQUEST['setobject']) && $_REQUEST['setobject'] > 0) && (is_numeric($_REQUEST['to_id']) && $_REQUEST['to_id'] > 0) && !$_REQUEST['gift'] && $_REQUEST['sd4'] == $user['id']) {
|
}
|
||||||
/* post.php?to_id=<?= $idkomu ?>&id_th=<?= $row['id'] ?>&setobject=<?= $row['id'] ?>&sd4=<?= $user['id'] ?> */
|
$statusMessage = 'Телеграф сломался!';
|
||||||
$res = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `id` = '{$_REQUEST['setobject']}' AND `dressed` = 0 AND `setsale` = 0 AND `present` = '' AND `artefact` = 0 LIMIT 1;"));
|
|
||||||
|
if ($submit == 'sendItem' && $sendItemId && $user['money'] >= 1) {
|
||||||
|
$res = db::c()->query('SELECT `id`,`name` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0', $_SESSION['uid'], $sendItemId, null)->fetch_assoc();
|
||||||
if (!$res['id']) {
|
if (!$res['id']) {
|
||||||
$mess = "Предмет не найден в рюкзаке";
|
$statusMessage = "Предмет не найден в рюкзаке.";
|
||||||
} elseif ($user['money'] < 1) {
|
|
||||||
$mess = 'Недостаточно денег на оплату передачи';
|
|
||||||
} else {
|
} else {
|
||||||
if (mysql_query("UPDATE `inventory` SET `owner` = " . $komu['id'] . " WHERE `id`='" . $res['id'] . "' AND `owner`= '" . $user['id'] . "';")) {
|
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
|
||||||
mysql_query("UPDATE `users` SET `money`=`money`-1 WHERE `id`='" . $user['id'] . "'");
|
db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']);
|
||||||
mysql_query("INSERT INTO `delo`(`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','Почтой передан предмет \"" . $res['name'] . "\" id:(cap" . $res['id'] . ") [" . $res['duration'] . "/" . $res['maxdur'] . "] от \"" . $user['login'] . "\" к \"" . $komu['login'] . "\", налог 1 кр.','1','" . time() . "');");
|
//TODO: Добавить логи и статистику.
|
||||||
mysql_query("INSERT INTO `delo`(`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$idkomu}','Почтой передан предмет \"" . $res['name'] . "\" id:(cap" . $res['id'] . ") [" . $res['duration'] . "/" . $res['maxdur'] . "] от \"" . $user['login'] . "\" к \"" . $komu['login'] . "\", налог 1 кр.','1','" . time() . "');");
|
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
|
||||||
$mess = 'Удачно передано "' . $res['name'] . '" к персонажу ' . $komu['login'];
|
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: '. $res['name'] .' от персонажа ' .$user['login']. '.');
|
||||||
$user['money'] -= 1;
|
|
||||||
$us = mysql_fetch_array(mysql_query("select `id` from `online` WHERE `date` >= " . (time() - 60) . " AND `id` = '{$komu['id']}' LIMIT 1;"));
|
|
||||||
if ($us[0]) {
|
|
||||||
addchp('<font color=red>Внимание!</font> Вам почтой передан предмет <b>' . $res['name'] . '</b> от <span oncontextmenu=OpenMenu()>' . $user['login'] . '</span> ', '{[]}' . $_POST['to_login'] . '{[]}');
|
|
||||||
} else {
|
|
||||||
// если в офе
|
|
||||||
mysql_query("INSERT INTO `telegraph` (`receiver`,`date`,`text`) VALUES ('" . $to['id'] . "','','" . '<font color=red>Внимание!</font> Вам почтой передан предмет <b>' . $res['name'] . '</b> от <span oncontextmenu=OpenMenu()>' . $user['login'] . '</span> ' . "');");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$queryItems = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0 ORDER BY `update` DESC', $_SESSION['uid'], null);
|
$queryItems = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0 ORDER BY `update` DESC', $_SESSION['uid'], null);
|
||||||
}
|
}
|
||||||
} else $allowOperations = false;
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -80,8 +75,11 @@ if ($_SESSION['receiverName']) {
|
|||||||
<body>
|
<body>
|
||||||
<h1>Почта</h1>
|
<h1>Почта</h1>
|
||||||
<a href=# onclick=leave()> ← выйти на Центральную площадь</a>
|
<a href=# onclick=leave()> ← выйти на Центральную площадь</a>
|
||||||
<br>
|
<div style="text-align: center;">
|
||||||
<?php if (true == $allowOperations): ?>
|
<?php if (isset($statusMessage)) err($statusMessage); ?>
|
||||||
|
</div>
|
||||||
|
<legend>Услуги почты платные: 1 кредит.</legend>
|
||||||
|
<?php if ($_SESSION['receiverName']): ?>
|
||||||
Получатель: <?= nick::id($receiverId)->full() ?>
|
Получатель: <?= nick::id($receiverId)->full() ?>
|
||||||
<a href="?change">Сменить</a>
|
<a href="?change">Сменить</a>
|
||||||
<table width=100%>
|
<table width=100%>
|
||||||
@ -102,13 +100,16 @@ if ($_SESSION['receiverName']) {
|
|||||||
</td>
|
</td>
|
||||||
<td valign=top align=right>
|
<td valign=top align=right>
|
||||||
<table class="zebra" WIDTH=100%">
|
<table class="zebra" WIDTH=100%">
|
||||||
|
<th colspan="2">Передача предметов</th>
|
||||||
<?php while ($row = $queryItems->fetch_assoc()): ?>
|
<?php while ($row = $queryItems->fetch_assoc()): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td align=center>
|
<td align=center>
|
||||||
<IMG SRC="i/sh/<?= $row['img'] ?>" BORDER=0>";
|
<img src="i/sh/<?= $row['img'] ?>"><br>
|
||||||
<BR>
|
<form method="post">
|
||||||
<a href="post.php?to_id=<?= $_SESSION['receiverName'] ?>&id_th=<?= $row['id'] ?>&setobject=<?= $row['id'] ?>&sd4=<?= $user['id'] ?>&rnd=<?= mt_rand() ?>"
|
<input type="hidden" name="action" value="sendItem">
|
||||||
onclick="return confirm('Передать предмет<?= $row['name'] ?>?')">передать за 1 кр.</a>
|
<input type="hidden" name="item_id" value="<?= $row['id'] ?>">
|
||||||
|
<input type="submit" value="Передать за 1кр.">
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td valign=top>
|
<td valign=top>
|
||||||
<?php showitem($row); ?>
|
<?php showitem($row); ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user