Размер файла: 2.2Kb
<?php
/**
* Created by PhpStorm.
* User: Valeriy Shikuta aka Str@nnik
* Date: 14.02.2016
* Time: 15:45
* File: view.php
* ICQ: 609-745-227
* E-mail: [email protected]
*/
if ($id)
{
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `board_categories` WHERE `id` = $id"));
$father_cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `board_categories` WHERE `id` = " . $cat['cat_id'] . ""));
echo '<div class="phdr"><a href="./">Доска объявлений</a> | <a href="./?id=' . $father_cat['id'] . '">' . $father_cat['name'] . '</a> | ' . $cat['name'] . '</div>';
echo ($user_id) ? '<div class="gmenu"><a href="./?act=add_ad&id=' . $id . '">Добавить объявление</a></div>' : null;
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `board_ads` WHERE `cat_id` = $id AND `status` = 1"), 0);
if ($total)
{
$req = mysql_query("SELECT * FROM `board_ads` WHERE `cat_id` = $id AND `status` = 1 ORDER BY `time` DESC LIMIT $start, $kmess");
$i = 0;
while ($res = mysql_fetch_assoc($req))
{
echo ($i % 2) ? '<div class="list1">' : '<div class="list2">';
if (time() > $res['end']) mysql_query("UPDATE `board_ads` SET `status` = 2 WHERE `id` = " . $res['id'] . "");
echo (!empty($res['img'])) ? '<img src="../images/board/small/' . $res['img'] . '.png" align="middle" alt="' . $res['img'] . '">' : '<img src="../images/no_board.png" width="25" height="25" align="middle" alt="' . $res['img'] . '">';
echo ' <a href="./?act=view&id=' . $res['id'] . '">' . $res['name'] . '</a>'
. '</div>';
$i++;
}
}
else
{
echo '<div class="menu">Объявлений еще не добавлено</div>';
}
echo '<div class="phdr">Всего: ' . $total . '</div>';
if ($total > $kmess)
echo '<div class="topmenu">' . functions::display_pagination('./?act=list&id=' . $id . '&', $start, $total, $kmess) . '</div>';
echo '<div class="menu"><a href="./?id=' . $cat['cat_id'] . '">В категорию</a></div>';
}
else
{
header('location: ./');
}