Файл: modules/shop/reviews.php
Строк: 29
<?php
$title = 'Отзывы';
include_once($_SERVER["DOCUMENT_ROOT"].'/style/head.php');
$_GET['id'] = abs(intval($_GET['id']));
if($db->query("SELECT `id` FROM `shop_goods` WHERE `id`='".$_GET['id']."'")->num_rows==0) {
error('Товара не существует.');
}
$good = $db->query("SELECT `id`, `name` FROM `shop_goods` WHERE `id`='".$_GET['id']."'")->fetch_assoc();
?>
<div class="title">
<a href="/shop">Магазин</a>
|
<a href="/shop/good/<?=$good['id']?>"><?=htmlspecialchars($good['name'])?></a>
|
Отзывы
</div>
<?
if(isset($user['id']) AND $db->query("SELECT `id` FROM `shop_buy` WHERE `id_us`='".$user['id']."' AND `id_good`='".$_GET['id']."'")->num_rows!=0 AND $db->query("SELECT `id` FROM `shop_reviews` WHERE `id_good`='".$_GET['id']."' AND `id_us`='".$user['id']."'")->num_rows==0) {
?>
<div class="nvg">
<a href="/shop/new_reviews/<?=$_GET['id']?>">Добавить отзыв</a>
</div>
<?
}
$nav=new navig("SELECT * FROM `shop_reviews` WHERE `id_good`='".$_GET['id']."'");
$q = $db->query("SELECT * FROM `shop_reviews` WHERE `id_good`='".$_GET['id']."' ORDER BY `id` DESC LIMIT ".$nav->start.", ".$nav->nstr);
while($f = $q->fetch_assoc()){
?>
<div class="textq">
<?=nick($f['id_us'])?><br/>
<?=times($f['time'])?><br/>
Тип: <b><?if($f['type']==1){?><font color="green">Положительный</font><?}else{?><font color="red">Отрицательный</font><?}?></b>
</div>
<?
}
?>
<div class="nvgstr">
<?
$nav->panel();
?>
</div>
<?
if($db->query("SELECT `id` FROM `shop_reviews` WHERE `id_good`='".$_GET['id']."'")->num_rows==0){
error('Отзывов к данному товару ещё никто не оставлял.');
}
include_once($_SERVER["DOCUMENT_ROOT"].'/style/foot.php');
?>