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'])) {