File size: 1.89Kb
<?php
/**
* Created by PhpStorm.
* User: Valeriy Shikuta aka Str@nnik
* Date: 15.02.2016
* Time: 18:34
* File: archive.php
* ICQ: 609-745-227
* E-mail: [email protected]
*/
echo '<div class="phdr"><a href="./">Объявления</a> | Архив</div>';
if ($id)
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `board_ads` WHERE `user_id` = $id AND `status` = 2"), 0);
else
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `board_ads` WHERE `status` = 2"), 0);
if ($total)
{
if ($id)
$req = mysql_query("SELECT * FROM `board_ads` WHERE `user_id` = $id AND `status` = 2 ORDER BY `end` DESC LIMIT $start, $kmess");
else
$req = mysql_query("SELECT * FROM `board_ads` WHERE `status` = 2 ORDER BY `end` 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>'
. ' <span class="red">[' . functions::display_date($res['end']) . ']</span>'
. '</div>';
$i++;
}
}
else
{
echo '<div class="menu">У юзера нету активных объявлений</div>';
}
echo '<div class="phdr">Всего: ' . $total . '</div>';
if ($total > $kmess)
echo '<div class="topmenu">' . functions::display_pagination(($id ? './?act=archive&id=' . $id . '&' : './?act=archive&'), $start, $total, $kmess) . '</div>';