View file user/gift/index.php

File size: 2.42Kb
<?php
require( '../../sys/inc/core.php' );
only_reg();
$width = ( $webbrowser == 'web' ? '100' : '70' );
if ( isset( $_GET['id'] ) )
    $ank['id'] = intval( $_GET['id'] );
else
    $ank['id'] = $user['id'];
$ank = get_user( $ank['id'] );
if ( !$ank || $ank['id'] == 0 ) {
    header( "Location: /index.php?" . SID );
    exit;
}
$set['title'] = 'Подарки ' . $ank['nick'];
include_once '../../sys/inc/thead.php';
title();
aut();
echo '<div class="foot">';
echo '<img src="/style/icons/str2.gif" alt="*" /> <a href="/info.php?id=' . $ank['id'] . '">' . $ank['nick'] . '</a> | <b>Подарки</b>';
echo '</div>';
$k_post = db::count("SELECT COUNT(id) FROM `gifts_user` WHERE `id_user` = '$ank[id]'" . ( $ank['id'] != $user['id'] ? " AND `status` = '1' " : "" ) . "");
if ( $k_post == 0 ) {
    echo '<div class="mess">';
    echo 'Нет подарков';
    echo '</div>';
}
$k_page = k_page( $k_post, $set['p_str'] );
$page   = page( $k_page );
$start  = $set['p_str'] * $page - $set['p_str'];
$q      = db::query("SELECT id,status,coment,id_gift,id_ank,time FROM `gifts_user` WHERE `id_user` = '$ank[id]'" . ( $ank['id'] != $user['id'] ? " AND `status` = '1' " : "") . " ORDER BY `time` DESC LIMIT $start, $set[p_str]" );
while ( $post =  $q->fetch_assoc() ) {
    $gift   = db::fetch("SELECT id,name FROM `gift_list` WHERE `id` = '$post[id_gift]' LIMIT 1", ARRAY_A);
    $anketa = get_user( $post['id_ank'] );
    if ( $num == 0 ) {
        echo '<div class="nav1">';
        $num = 1;
    } elseif ( $num == 1 ) {
        echo '<div class="nav2">';
        $num = 0;
    }
    echo '<img src="/sys/gift/' . $gift['id'] . '.png" style="max-width:' . $width . 'px;" alt="*" /><br />';
    echo '<img src="/style/icons/present.gif" alt="*" /> <a href="gift.php?id=' . $post['id'] . '"><b>' . htmlspecialchars( $gift['name'] ) . '</b></a> :: ';
    echo 'от ' . group( $anketa['id'] ), '<a href="/info.php?id=' . $anketa['id'] . '">' . $anketa['nick'] . '</a>', medal( $anketa['id'] ), online( $anketa['id'] ), ' ' . vremja( $post['time'] );
    if ( $post['status'] == 0 )
        echo ' <font color=red>NEW</font> ';
    echo '</div>';
}
if ( $k_page > 1 )
    str( 'index.php?id=' . intval( $_GET['id'] ) . '&amp;', $k_page, $page );
echo '<div class="foot">';
echo '<img src="/style/icons/str2.gif" alt="*" /> <a href="/info.php?id=' . $ank['id'] . '">' . $ank['nick'] . '</a> | <b>Подарки</b>';
echo '</div>';
include_once '../../sys/inc/tfoot.php';
?>