Final: Делаем подарки.

This commit is contained in:
Igor Barkov [iwork] 2019-01-28 18:15:24 +02:00
parent 04a7aa6287
commit 540e5bace9
2 changed files with 5 additions and 4 deletions

View File

@ -72,7 +72,7 @@ if (!empty($user['realname'])) echo "Имя: " . $user['realname'] . "<br>";
while ($row = $presents_new->fetch_assoc())
if (empty($row['sender'])) $sender = 'Анонимный подарок';
else $sender = 'Подарок от ' . $row['sender'];
echo "<img src=i/presents/{$row['img']} class='tooltip' title='Подарок от {$sender}'>";
echo "<img src={$row['img']} class='tooltip' title='Подарок от {$sender}'>";
?>
</div>
<?php endif; ?>

View File

@ -52,9 +52,10 @@ if (!empty($_POST['sendAction'])) {
else $from = $user['login'];
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', $cost, $_SESSION['uid']);
db::c()->query('INSERT INTO users_presents (owner, img, text, sender, expiration_date) VALUES (?i,"?s","?s","?s",DATE_ADD(NOW(),INTERVAL ?i DAY))', $receiver['id'], $_POST['present'], $_POST['text'], $_POST['from'], $_POST['days']);
$deloText = "{$user['login']} купил подарок за {$cost} кр. и подарил его персонажу {$_POST['receiver']}";
addToDelo($deloText);
db::c()->query('INSERT INTO users_presents (owner, img, text, sender, expiration_date) VALUES (?i,"?s","?s","?s",DATE_ADD(NOW(),INTERVAL ?i DAY))', $receiver['id'], $_POST['present'], $_POST['text'], $_POST['sender'], $_POST['days']);
#FIXME Я так не хочу подключать functions!
// $deloText = "{$user['login']} купил подарок за {$cost} кр. и подарил его персонажу {$_POST['receiver']}";
// addToDelo($deloText);
$telegraphText = "Вам пришёл подарок от {$from}!";
db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $receiver['id'], $telegraphText)->fetch_assoc();
$status = "Подарок удачно доставлен к {$_POST['receiver']}! Вы потратили <b>{$cost}</b> кр.";