Просмотр файла board/includes/view.php

Размер файла: 1.62Kb
<?php
/**
 * Created by PhpStorm.
 * User: Valeriy Shikuta aka Str@nnik
 * Date: 15.02.2016
 * Time: 11:38
 * File: view.php
 * ICQ: 609-745-227
 * E-mail: [email protected]
 */

if ($id)
{
    mysql_query("UPDATE `board_ads` SET `views` = `views` + 1 WHERE `id` = $id");

    $ad = mysql_fetch_assoc(mysql_query("SELECT * FROM `board_ads` WHERE `id` = $id"));
    echo '<div class="phdr">' . $ad['name'] . '</div>';

    echo ($rights >= 7 || $user_id == $ad['user_id']) ? '<div class="gmenu"><a href="./?act=edit_ad&amp;id=' . $ad['id'] . '">Редактировать</a>&nbsp;|&nbsp;<a href="./?act=del_ad&amp;id=' . $ad['id'] . '">Удалить</a></div>' : null;

    $author = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = " . $ad['user_id'] . ""));

    echo '<div class="bmenu">Автор объявления:&nbsp;<a href="../users/profile.php?user=' . $author['id'] . '">' . $author['name'] . '</a>&nbsp;(' . functions::display_date($ad['time']) . ')<br>Окончание:&nbsp;' . functions::display_date($ad['end']) . '<br>Просмотров:&nbsp;' . $ad['views'] . '</div>'
        . '<div class="menu">' . functions::smileys(functions::checkout($ad['desc'], 1, 1), $res['rights'] >= 1 ? 1 : 0) . '</div>';

    echo (!empty($ad['img'])) ? '<div class="gmenu"><a href="../images/board/' . $ad['img'] . '.png"><img src="../images/board/' . $ad['img'] . '.png" width="100" height="100" alt="' . $ad['img'] . '"></a></div>' : null;
    echo '<div class="menu"><a href="./?act=list&amp;id=' . $ad['cat_id'] . '">В категорию</a></div>';
}
else
{
    header('location: ./');
}