Файл: public_html/includes/comm_by.php
Строк: 21
<?php
$user_r = mysql_query("select `id` from `users` where `id` = '$id'");
$user = mysql_fetch_assoc($user_r);
if ($user['id']) {
switch ($type) {
case 'blogs': $index = 'Полезные коды'; break;
case 'loads': $index = 'ЗЦ'; break;
case 'photos': $index = 'Фото'; break;
}
echo '<div class="title"><a href="index.php">'.$index.'</a>» комментарии '.username($id, 1).'</div>';
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$comm_r = mysql_query("SELECT * FROM `".$type."_comm` WHERE `id_user` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($comm = mysql_fetch_assoc($comm_r)) {
$typen = mysql_fetch_assoc(mysql_query("select `name` from $type where `id` = '".$comm['id_'.$type]."'"));
$comms = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `id_$type` = '".$comm['id_'.$type]."'"), 0);
echo '<div class="row"><a href="index.php?act=comm&id='.$comm['id_'.$type].'"><b>'.$typen['name'].'</b> ('.$comms.')</a><br />'.$comm['text'].' ('.ccdate($comm['time'], 0).')</div>';
}
} else {
echo '<div class="error">Комментариев нет</div>';
}
navig($page, '?act=comm_by&id='.$id.'&', $pages);
} else {
redirect('?');
}
?>