Final: Делаем подарки.
This commit is contained in:
parent
849ffbeb0c
commit
bf585364cd
10
inf.php
10
inf.php
@ -10,7 +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();
|
$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 = 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']);
|
$presents_new = db::c()->query('SELECT img, sender FROM `users_presents` WHERE owner = ?i',$user['id']);
|
||||||
|
|
||||||
if (empty($user['id'])): ?>
|
if (empty($user['id'])): ?>
|
||||||
<html>
|
<html>
|
||||||
@ -69,11 +69,9 @@ if (!empty($user['realname'])) echo "Имя: " . $user['realname'] . "<br>";
|
|||||||
<div>
|
<div>
|
||||||
<legend>Подарки+</legend>
|
<legend>Подарки+</legend>
|
||||||
<?php
|
<?php
|
||||||
while ($row = $presents_new->fetch_assoc())
|
while ($row = $presents_new->fetch_assoc()): ?>
|
||||||
if (empty($row['sender'])) $sender = 'Анонимный подарок';
|
<img src="<?= $row['img'] ?>" title="<?= $row['sender'] ?>" alt="<?= $row['sender'] ?>">
|
||||||
else $sender = 'Подарок от ' . $row['sender'];
|
<?php endwhile;?>
|
||||||
echo "<img src={$row['img']} class='tooltip' title='Подарок от {$sender}'>";
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if (!empty($user['prof1']) OR !empty($user['prof2'])): ?>
|
<?php if (!empty($user['prof1']) OR !empty($user['prof2'])): ?>
|
||||||
|
14
presents.php
14
presents.php
@ -47,17 +47,15 @@ if (!empty($_POST['sendAction'])) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['sender'] == 1) $from = null;
|
if ($_POST['sender'] == 1) $sender = "Анонимный подарок";
|
||||||
elseif ($_POST['sender'] == 2 && $user['ClanName']) $from = ' клана ' . $user['ClanName'];
|
elseif ($_POST['sender'] == 2 && $user['ClanName']) $sender = "Подарок от клана {$user['ClanName']}";
|
||||||
else $from = $user['login'];
|
else $sender = "Подарок от {$user['login']}";
|
||||||
|
|
||||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', $cost, $_SESSION['uid']);
|
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['sender'], $_POST['days']);
|
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'], $sender, $_POST['days']);
|
||||||
#FIXME Я так не хочу подключать functions!
|
|
||||||
// $deloText = "{$user['login']} купил подарок за {$cost} кр. и подарил его персонажу {$_POST['receiver']}";
|
|
||||||
// addToDelo($deloText);
|
|
||||||
$telegraphText = "Вам пришёл подарок от {$from}!";
|
$telegraphText = "Вам пришёл подарок от {$from}!";
|
||||||
db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $receiver['id'], $telegraphText)->fetch_assoc();
|
db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $receiver['id'], $telegraphText);
|
||||||
$status = "Подарок удачно доставлен к {$_POST['receiver']}! Вы потратили <b>{$cost}</b> кр.";
|
$status = "Подарок удачно доставлен к {$_POST['receiver']}! Вы потратили <b>{$cost}</b> кр.";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user