battles/user_gifts.php
2018-01-28 18:40:49 +02:00

24 lines
1.7 KiB
PHP

<?
include('config.php');
if(isset($_GET['gift'])) {
if(isset($_GET['user'])) {
$us = mysql_real_escape_string($_GET['user']);
$lime = $_GET['lime']*15;
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '".$us."' AND (`name` LIKE '%Сувенир%' OR `name` LIKE '%Подарок%' OR `name` LIKE '%Валентинка%' OR `name` LIKE '%Открытка%' OR `name` LIKE 'Ель%' OR `name` LIKE '%Медаль%' OR `name` LIKE '%Статуэтка%') AND `present` != '' AND `cost` < 24 ORDER BY `id` DESC LIMIT $lime");
$cnt = mysql_query("SELECT `id` FROM `inventory` WHERE `owner` = '".$us."' AND (`name` LIKE '%Сувенир%' OR `name` LIKE '%Подарок%' OR `name` LIKE '%Валентинка%' OR `name` LIKE '%Открытка%' OR `name` LIKE 'Ель%' OR `name` LIKE '%Медаль%' OR `name` LIKE '%Статуэтка%') AND `present` != '' AND `cost` < 24");
if(mysql_num_rows($data)) { echo '<br />Сувениры : <br />'; }
$i = 0;
while($row = mysql_fetch_array($data)) {
$why_gift = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `users` WHERE `login` = '".mysql_real_escape_string($row['present'])."' LIMIT 1"));
echo '<a href="inf.php?'.$why_gift['id'].'"><img src="i/sh/'.$row['img'].'" border="0" class=\'tooltip\' title="<b>'.$row['name'].'</b><br />Подарил: <b>'.$row['present'].'</b><br /><b class=\'txt\'>'.$row['letter'].'</b>" /></a>';
$i++;
}
if($i < mysql_num_rows($cnt)) {
echo '<br /><a href=\'javascript:void(0);\' id=\'showmore_gift\' value=\'1\'>Показать еще подарки</a>';
} else {
echo '<br /><b>Подарков больше нет</b>'.$cnt;
}
}
}