Ремонт почты
This commit is contained in:
parent
236631222b
commit
54dd762aa1
20
css/main.css
20
css/main.css
@ -9,13 +9,13 @@ BODY {
|
||||
COLOR: #000000;
|
||||
}
|
||||
|
||||
H1,H2,H3,H4,H5,H6 {
|
||||
H1, H2, H3, H4, H5, H6 {
|
||||
FONT-WEIGHT: bold;
|
||||
COLOR: #8f0000;
|
||||
}
|
||||
|
||||
H3 {
|
||||
TEXT-ALIGN: center
|
||||
TEXT-ALIGN: center
|
||||
}
|
||||
|
||||
A, A:visited {
|
||||
@ -48,7 +48,7 @@ A:hover {
|
||||
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;
|
||||
COLOR: red;
|
||||
BACKGROUND-COLOR: #fae0e0
|
||||
@ -1000,6 +1000,7 @@ table.adm {
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.adm th {
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
@ -1007,19 +1008,28 @@ table.adm th {
|
||||
padding: 10px 8px;
|
||||
border-bottom: 2px solid #6678b1;
|
||||
}
|
||||
|
||||
table.adm td {
|
||||
border-bottom: 1px solid #ccc;
|
||||
color: #669;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
table.adm tbody tr:hover td
|
||||
{
|
||||
|
||||
table.adm tbody tr:hover td {
|
||||
color: #009;
|
||||
}
|
||||
|
||||
table.zebra tr {
|
||||
background-color: #C7C7C7;
|
||||
}
|
||||
|
||||
table.zebra tr:nth-child(even) {
|
||||
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.
|
||||
*/
|
||||
$u = new users_row($_SESSION['uid']);
|
||||
$user = $u->result();
|
||||
$user = (new users_row($_SESSION['uid']))->result();
|
||||
|
||||
if (isset($user['id']) && $user['block'] == 1) {
|
||||
die();
|
||||
|
67
post.php
67
post.php
@ -13,7 +13,7 @@ if ($user['battle'] != 0) {
|
||||
die();
|
||||
}
|
||||
|
||||
$changeReceiver = filter_input(INPUT_GET,'change');
|
||||
$changeReceiver = filter_input(INPUT_GET, 'change');
|
||||
if ($changeReceiver) unset($_SESSION['receiverName']);
|
||||
|
||||
$razdelId = filter_input(INPUT_GET, 'razdel');
|
||||
@ -23,12 +23,16 @@ $queryItems = null;
|
||||
|
||||
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 {
|
||||
$allowOperations = true;
|
||||
if (!$receiver['id']) {
|
||||
err('Персонажа не существует!');
|
||||
unset($_SESSION['receiverName']);
|
||||
} elseif ($receiver['level'] < 4) {
|
||||
err('Персонажей ниже 4-го уровня не обслуживаем!');
|
||||
unset($_SESSION['receiverName']);
|
||||
} else {
|
||||
$receiverId = $receiver['id'];
|
||||
$submit = filter_input(INPUT_POST, 'action');
|
||||
$sendItemId = filter_input(INPUT_POST,'item_id');
|
||||
$telegraphText = filter_input(INPUT_POST, 'message');
|
||||
|
||||
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('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, $telegraphText);
|
||||
$statusMessage = 'Сообщение отправлено.';
|
||||
} else err('Сообщение было оставлено пустым!');
|
||||
} 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'] ?> */
|
||||
$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;"));
|
||||
} else $statusMessage = 'Сообщение было оставлено пустым!';
|
||||
}
|
||||
$statusMessage = 'Телеграф сломался!';
|
||||
|
||||
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']) {
|
||||
$mess = "Предмет не найден в рюкзаке";
|
||||
} elseif ($user['money'] < 1) {
|
||||
$mess = 'Недостаточно денег на оплату передачи';
|
||||
$statusMessage = "Предмет не найден в рюкзаке.";
|
||||
} else {
|
||||
if (mysql_query("UPDATE `inventory` SET `owner` = " . $komu['id'] . " WHERE `id`='" . $res['id'] . "' AND `owner`= '" . $user['id'] . "';")) {
|
||||
mysql_query("UPDATE `users` SET `money`=`money`-1 WHERE `id`='" . $user['id'] . "'");
|
||||
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() . "');");
|
||||
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() . "');");
|
||||
$mess = 'Удачно передано "' . $res['name'] . '" к персонажу ' . $komu['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> ' . "');");
|
||||
}
|
||||
}
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
|
||||
db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']);
|
||||
//TODO: Добавить логи и статистику.
|
||||
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
|
||||
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: '. $res['name'] .' от персонажа ' .$user['login']. '.');
|
||||
}
|
||||
}
|
||||
$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>
|
||||
<html>
|
||||
@ -80,8 +75,11 @@ if ($_SESSION['receiverName']) {
|
||||
<body>
|
||||
<h1>Почта</h1>
|
||||
<a href=# onclick=leave()> ← выйти на Центральную площадь</a>
|
||||
<br>
|
||||
<?php if (true == $allowOperations): ?>
|
||||
<div style="text-align: center;">
|
||||
<?php if (isset($statusMessage)) err($statusMessage); ?>
|
||||
</div>
|
||||
<legend>Услуги почты платные: 1 кредит.</legend>
|
||||
<?php if ($_SESSION['receiverName']): ?>
|
||||
Получатель: <?= nick::id($receiverId)->full() ?>
|
||||
<a href="?change">Сменить</a>
|
||||
<table width=100%>
|
||||
@ -102,13 +100,16 @@ if ($_SESSION['receiverName']) {
|
||||
</td>
|
||||
<td valign=top align=right>
|
||||
<table class="zebra" WIDTH=100%">
|
||||
<th colspan="2">Передача предметов</th>
|
||||
<?php while ($row = $queryItems->fetch_assoc()): ?>
|
||||
<tr>
|
||||
<td align=center>
|
||||
<IMG SRC="i/sh/<?= $row['img'] ?>" BORDER=0>";
|
||||
<BR>
|
||||
<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'] ?>?')">передать за 1 кр.</a>
|
||||
<img src="i/sh/<?= $row['img'] ?>"><br>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="sendItem">
|
||||
<input type="hidden" name="item_id" value="<?= $row['id'] ?>">
|
||||
<input type="submit" value="Передать за 1кр.">
|
||||
</form>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?php showitem($row); ?>
|
||||
|
Loading…
Reference in New Issue
Block a user