From 4370e6770adc9205cb380ddade9eb5d73595cb5d Mon Sep 17 00:00:00 2001 From: "Igor Barkov [iwork]" Date: Mon, 28 Jan 2019 16:53:11 +0200 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B5=D0=BB=D0=B0=D0=B5=D0=BC=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inf.php | 32 +++++++++++++++++-------- presents.php | 66 +++++++++++++++++++++++++++++----------------------- 2 files changed, 59 insertions(+), 39 deletions(-) diff --git a/inf.php b/inf.php index 928780e..3483bf8 100644 --- a/inf.php +++ b/inf.php @@ -10,6 +10,7 @@ $user = db::c()->query('SELECT `id`,`login`,`married`,`win`,borndate,`align`,`ad $own = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = "?s"', $uid)->fetch_assoc(); $presents = db::c()->query('SELECT `img`,`present` FROM `inventory` WHERE type = 200 AND `present`<>"?s" AND `owner` = ?i', '', $user['id']); +$presents_new = db::c()->query('SELECT img, sender FROM `users_presents` WHERE owner = ?i',$user['id']); if (empty($user['id'])): ?> @@ -55,28 +56,39 @@ if (!empty($user['realname'])) echo "Имя: " . $user['realname'] . "
"; ?>


-
+getNumRows()): ?>
Подарки getNumRows()) - while ($row = $presents->fetch_assoc()) - echo ""; + while ($row = $presents->fetch_assoc()) + echo ""; ?>
+ +getNumRows()): ?> +
+ Подарки+ + fetch_assoc()) + if (empty($row['sender'])) $sender = 'Анонимный подарок'; + else $sender = 'Подарок от ' . $row['sender']; + echo ""; + ?> +
+ +
Лицензии Лицензия наемника" /> '; - if ($user['prof2'] == 22) echo ' '; - if ($user['prof1'] == 1) echo ' '; - if ($user['prof1'] == 2) echo ' '; + if ($user['prof2'] == 21) echo ' '; + if ($user['prof2'] == 22) echo ' '; + if ($user['prof1'] == 1) echo ' '; ?>
-
+ query('SELECT `login`, `name` AS `ClanName`, u.`money` +FROM `users` u + LEFT JOIN `clans` c ON c.`id` = `klan` +WHERE u.`id` = ?i', $_SESSION['uid'])->fetch_assoc(); $dirname = "i/presents/"; $images = glob($dirname . "*.png"); if (!empty($_POST['present'])) { - if (empty($_POST['to_login'])) return 'Получатель не указан!'; - if ($_POST['to_login'] == $user['login']) return 'Очень щедро - дарить что-то самому себе! ;)'; - if ($_POST['flower']) { - $to = db::c()->query('SELECT `id`,`login`,`room` FROM `users` WHERE `login` = ?i', $_POST['to_login'])->fetch_assoc(); - - if ($_POST['from'] == 1) $from = 'Аноним'; - elseif ($_POST['from'] == 2 && $user['klan']) $from = ' клана ' . $user['klan']; - else $from = $user['login']; - - db::c()->query('UPDATE `inventory` SET `owner` = ?i, `present` = "?s", `letter` = "?s" WHERE `present` = "?s" AND `id` = "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $to['id'], $from, $_POST['podarok2'], null, $_POST['flower'], $_SESSION['uid']); - $res = db::c()->query('SELECT `id`,`name`,`duration`,`maxdur` FROM `inventory` WHERE `id` = ?i', $_POST['flower'])->fetch_assoc(); - - $deloText = "{$user['login']} купил подарок «%PodarokName%» за %PodarokCost% кр. и подарил его персонажу {$_POST['to_login']}"; - addToDelo($deloText); - $telegraphText = "Вам пришёл подарок \"" . $res['name'] . "\" от " . $from . "!"; - db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $to['id'], $telegraphText)->fetch_assoc(); - - err('Подарок удачно доставлен к ' . $_POST['to_login']); - + if (empty($_POST['receiver'])) { + $status = 'Получатель не указан!'; + return; } -} + if (empty($_POST['days']) OR $_POST['days'] < 1 OR !is_numeric($_POST['days'])) $_POST['days'] = 1; + + $to = db::c()->query('SELECT `id` FROM `users` WHERE `login` = ?i', $_POST['receiver'])->fetch_assoc(); + + if ($_POST['from'] == 1) $from = 'Аноним'; + elseif ($_POST['from'] == 2 && $user['ClanName']) $from = ' клана ' . $user['ClanName']; + else $from = $user['login']; + + db::c()->query('UPDATE `inventory` SET `owner` = ?i, `present` = "?s", `letter` = "?s" WHERE `present` = "?s" AND `id` = "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $to['id'], $from, $_POST['text'], null, $_POST['flower'], $_SESSION['uid']); + $res = db::c()->query('SELECT `id`,`name`,`duration`,`maxdur` FROM `inventory` WHERE `id` = ?i', $_POST['flower'])->fetch_assoc(); + + $deloText = "{$user['login']} купил подарок «%PodarokName%» за %PodarokCost% кр. и подарил его персонажу {$_POST['receiver']}"; + addToDelo($deloText); + $telegraphText = "Вам пришёл подарок \"" . $res['name'] . "\" от " . $from . "!"; + db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $to['id'], $telegraphText)->fetch_assoc(); + + err('Подарок удачно доставлен к ' . $_POST['receiver']); + +} else $status = 'Не выбран тип подарка!'; ?> @@ -70,6 +77,9 @@ if (!empty($_POST['present'])) {

Магазин подарков

+
+Вы можете сделать подарок любому персонажу. Ваш подарок будет +отображаться в информации о персонаже.

Выберите подарок:
@@ -81,20 +91,18 @@ if (!empty($_POST['present'])) {
- - Вы можете сделать подарок любому персонажу. Ваш подарок будет - отображаться в информации о персонаже.

- -
-
+
+

Выберите, от чьего имени подарок:




Долговечность подарка (5кр в день):

-
+
+