Файл: 4mast/profmas.ru/downloads/votes.php
Строк: 30
<?php
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
$query = DB :: $dbs -> query ("SELECT * FROM `down_files` WHERE (`id`=?)", array ((int) $_GET['id']));
if ($query -> rowCount ()==0) {
header ('location: /zc');
exit;
}
$file = $query -> fetch ();
if (!isset ($file['dop']) || $file['dop']=='net') {
header ('location: /');
exit;
}
$kats = DB::$dbs->query ("SELECT * FROM `down_kats` WHERE (`id`='" . $file['id_kats'] . "')");
if ($query -> rowCount ()==0) {
header ('location:/');
exit;
}
$kats = $query -> fetch ();
$query = DB :: $dbs -> query ("SELECT * FROM `down_pods` WHERE (`id`='" . $file['id_pods'] . "')");
if ($query -> rowCount ()==0) {
header ('location:/');
exit;
}
$pods = $query -> fetch ();
H ($file['name'], '<a href="/downloads" style="color:white;">Обменник</a> / <a href="/downloads/pods' . $pods['id'] . '" style="color:white;">' . $pods['name'] . '</a> / ' . $file['name']);
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `down_votes` WHERE (`id_file`='" . $file['id'] . "')");
$items_per_page = 10;
$pages = ceil ( $items / $items_per_page );
if ($page < 1)
$page = 1;
if ($page > $pages)
$page = $pages;
$start = $page * $items_per_page - $items_per_page;
if ($items==0) {
echo '<div class="error">Данный файл не оценивали!</div>';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `down_votes` WHERE (`id_file`='" . $file['id'] . "') ORDER BY `id` DESC LIMIT $start, $items_per_page");
while ($vote = $query -> fetch()) {
echo '<div class="list1">' . Nick ($vote['kem']) . ' [' . datef ($vote['t']) . '] ' . ($vote['vot'] == 'za' ? '<b style="color:green;">+1</b>':'<b style="color:red;">-1</b>') . '<br/>Комментарий: ' . tag ($vote['komm']) . '<br/></div>';
}
echo '<div class="list1">' . page ('/downloads/votes' . $file['id'] ) . '</div>';
}
require_once('../includes/Footers.php');
?>