Размер файла: 1.6Kb
<?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.')<br />'.$comm['text'].'<br />Написано: '.ccdate($comm['time'], 0).'</a></div>';
}
} else {
echo '<div class="body">Их пока нет</div>';
}
echo '<div class="body">';
navig($page, '?act=comm_by&id='.$id.'&', $pages);
echo '<a href="index.php">'.$index.'</a>» комментарии '.username($id, 2).'</div>';
} else {
redirect('?');
}
?>