Файл: pages/comments.php
Строк: 38
<?PHP
require '../Core/start.php';
$title = 'Отзывы о сайте';
require '../Core/header.php';
$translitit = text($_GET['translitit']);
$site = mysql_fetch_array(mysql_query("SELECT `id` FROM `site` WHERE `translitit` = '$translitit'"));
$count_site = mysql_result(mysql_query("SELECT COUNT(*) FROM `comment` WHERE `id_site` = '".$site['id']."'"),0);
if(isset($_GET['id']) && isset($_GET['delete']))
{
$id = num($_GET['id']);
$count_comment2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `comment` WHERE `id` = '$id'"),0);
if($count_comment2 !== '0')
{
mysql_query("DELETE FROM `comment` WHERE `id` = '$id'");
message('Отзыв успешно удален');
}
else
{
error('Указаный отзыв не найден');
}
}
if($count_site !== '0')
{
$objects = $system['page'];
nav_start($count_site, $objects);
$comment_query = mysql_query("SELECT * FROM `comment` WHERE `id_site` = '".$site['id']."' ORDER BY `id` DESC LIMIT $start, $objects");
while($comment = mysql_fetch_array($comment_query))
{
?>
<div class="menu">
<b>Отзыв:</b>
<?
switch($comment['level'])
{
case '2': ?><span style="color:green;">Положительный</span><?
break;
case '1': ?><span style="color:red;">Отрицательный</span><?
break;
}
?>
<br />
<b>Текст отзыва:</b><br />
<?=$comment['text']?><br />
<?if(isset($user))
{
?><a href="<?=$translitit?>.html&id=<?=$comment['id']?>&delete">[Удалить]</a><?
}
?>
</div>
<?
}
# Выводим постраничную навигацию
view_nav('/pages/comments/'.$translitit.'.html&');
?><div class="vote"><a href="/pages/site/<?=$translitit?>.html">вернуться назад</a></div><?
}
else
{
?>
<div class="menu">
Отзывов о сайте нет
</div>
<div class="link"><a href="/pages/site/<?=$translitit?>.html">Назад в сайт</a></div>
<?
}
require '../Core/footer.php';
?>