View file user_gifts.php

File size: 4.83Kb
<?php
/**********************************************/
/* Автор скрипта: Александр Есин              */
/* E-Mail: [email protected] ([email protected]) */
/* ICQ: 6464729                               */
/* Site: http://ticlove.ru                    */
/**********************************************/
?>
<?php define ('SECURED', true); ?>
<?php require (dirname(__FILE__).'/_inc/sql.php'); ?>
<?php require (dirname(__FILE__).'/_inc/config.php'); ?>
<?php require (dirname(__FILE__).'/_inc/function.php'); ?>
<?php $title_page = 'Подарки пользователя'; ?>
<?php $description_page = 'Подарки пользователя'; ?>
<?php $keywords_page = 'Подарки пользователя'; ?>
<?php
if (!isset($_SESSION['auth_id'])) {
   header('Location: /');
   exit;
}
?>
<?php
$user_id = intval($_GET['user_id']);
if ($user_id == $_SESSION['auth_id'])
{
header('Location: /mygifts.php');
exit;
}

$sql = mysql_query("SELECT * FROM `q_users` WHERE `id_user` = '".$user_id."' LIMIT 1;");
if (mysql_num_rows($sql) == 0)
{
header('Location: /');
exit;
}
$user_array = mysql_fetch_array($sql);
?>
<?php include (dirname(__FILE__).'/include/header.php'); ?>
<div id="block_left">
<?php include (dirname(__FILE__).'/include/lider.php'); ?>
</div>
<div id="block_center">
<h3>Подарки пользователя</h3>
<div class="gifts_navigation">
<a href="/">Главная</a> &gt; <a href="user.php?id=<?php echo $user_id; ?>"><?php echo htmlspecialchars($user_array['name'], ENT_QUOTES); ?></a> &gt; Подарки
</div>
<?php
$col = GIFTS_PAGE;
if (isset($_GET['start'])) $start = abs(intval($_GET['start']));
else $start = 0;
$count_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `q_gifts` WHERE `send_user_id` = '".$user_id."';"), 0);
if ($count_p > 0)
{
if ($start >= $count_p) $start = 0;
$q = mysql_query("SELECT * FROM `q_gifts` INNER JOIN `q_users` ON `q_users`.`id_user` = `q_gifts`.`user_id` WHERE `q_gifts`.`send_user_id` = '".$user_id."' ORDER BY `q_gifts`.`id` DESC LIMIT ".$start.", ".$col);


while ($array = mysql_fetch_array($q)) { ?>
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="65" valign="top">
<a href="user.php?id=<?php echo $array['id_user']; ?>">
<?php if (!empty($array['avatar'])) { ?>
<img class="<?php echo ($array['vip_status'] == 1 ? 'photo_bor_vip' : 'photo_bor'); ?>" src="<?php echo DIR_PHOTOS; ?>/<?php echo $array['id_user']; ?>/<?php echo $array['avatar']; ?>" alt="" />
<?php } else { ?>
<img class="<?php echo ($array['vip_status'] == 1 ? 'photo_bor_vip' : 'photo_bor'); ?>" src="/images/no_photo_small.png" alt="" />
<?php } ?>
</a><br/>
<?php if (function_online($array['online']) == TRUE) { ?> <img src="/images/on.gif" alt="Сейчас на сайте" title="Сейчас на сайте" /><?php } ?>
</td>
<td align="left" valign="top">
От: 
<?php if ($array['vip_status'] == 1) { ?><img src="/images/vip.gif" alt="" width="16" height="16" title="VIP-пользователь" /> <?php } ?>
<a class="<?php echo ($array['pol'] == 1 ? 'm_color' : 'zh_color'); ?>" href="/user.php?id=<?php echo $array['id_user']; ?>"><?php echo htmlspecialchars($array['name'], ENT_QUOTES); ?></a>, <span class="vozrast"><?php echo function_vozrast_n($array['god'].'-'.$array['mes'].'-'.$array['day']); ?></span>
<br/>
<span class="city"><?php echo htmlspecialchars($array['city'], ENT_QUOTES); ?>, <?php echo htmlspecialchars($array['country'], ENT_QUOTES); ?></span><br/>
<span style="color: #a00000;">Дата: <?php echo function_vizit($array['date']); ?></span><br/>
<?php if (!empty($array['text'])) { ?>
<span style="font-style: italic; font-family: Georgia;"><?php echo htmlspecialchars(function_bigword($array['text'], 40), ENT_QUOTES); ?></span>
<?php } ?>
</td>
<td align="right" valign="top">
<?php
$gift_arr = mysql_fetch_array(mysql_query("SELECT * FROM `q_gifts_file` INNER JOIN `q_gifts_cat` ON `q_gifts_cat`.`id_gifts_cat` = `q_gifts_file`.`id_gifts_cat` WHERE `id_gifts_file` = '".$array['gift_id']."' LIMIT 1;"));
?>
<img src="/podarok/<?php echo $gift_arr['name_dir']; ?>/<?php echo $gift_arr['name_gift']; ?>.png" alt="" />
</td>
</tr>
</table>
<div style="margin: 7px 0; border-top: 5px dotted #ccc;"></div>
<?php } ?>
<?php function_page($_SERVER['PHP_SELF'].'?user_id='.$user_id.'&amp;', $col, $start, $count_p); ?>
<?php } else echo '<div style="text-align: center;">У пользователя '.htmlspecialchars($user_array['name'], ENT_QUOTES).' еще нет подарков.<br/>Вы можете стать первым, кто отправит '.($user_array['pol'] == 1 ? 'ему' : 'ей').' подарок!</div>';
?>
</div>
<div id="block_right">
<?php include (dirname(__FILE__).'/include/chat.php'); ?>
</div>
<div class="clear"></div>
<?php include (dirname(__FILE__).'/include/footer.php'); ?>