Просмотр поста #101602: Различные вопросы по PHP и MySQL

.
Udesign

ДоХтор, вот код

* (+/-)
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_news_comments` WHERE `refid`='$id';"), 0);
echo '<div class="phdr">Fikrlar (Umumiy: ' . $total . ' ta)</div>';
if($total) {
if ($total > $kmess)
echo '<div class="topmenu">' . functions::display_pagination('index.php?act=comments&amp;id=' . $id . '&amp;', $start, $total, $kmess) . '</div>';
$i = 1;
$req = mysql_query("SELECT `cms_news_comments`.*, `cms_news_comments`.`time` as `mtime`, `cms_news_comments`.`id` as `mid`, `users`.* FROM `cms_news_comments` LEFT JOIN `users` ON `cms_news_comments`.`user_id`=`users`.`id` WHERE `cms_news_comments`.`refid`='$id' ORDER BY `cms_news_comments`.`time` DESC LIMIT "
. $start . "," . $kmess);
while (($row = mysql_fetch_assoc($req)) !== false) {
$tartib = $i + $start;

echo $i % 2 ? '<div class="list1">' : '<div class="list2">';
$post = $row['text'];
$post = functions::checkout($post, 1, 1);
if ($set_user['smileys'])
$post = functions::smileys($post, $row['rights'] >= 1 ? 1 : 0);
if($row['reply'])
$post .= '<div class="reply">' . functions::checkout($row['reply'], 1, 1) . '</div>';
if($rights >= 6) $subtext = '<a href="index.php?act=comments&amp;mod=replay&amp;id=' . $id . '&amp;com=' . $row['mid'] . '">' . $lng['reply']. '</a> | <a href="index.php?act=comments&amp;mod=delete&amp;id=' . $id . '&amp;com=' . $row['mid'] . '">' . $lng['delete']. '</a></br>';
else $subtext = '';

$text = '#' . $tartib . ' <span class="gray">(' . functions::display_date($row['mtime']) . ')</span>';

if ($row['user_id'] == $user_id OR $row['last_rahmat'] == $user_id) {

 }else{
$text .=  ' <a href="index.php?act=view&amp;mod=rahmat&amp;id=' . $id . '&amp;mid=' . $row['mid'] . '">Rahmat</a> | ';

}

if ($user_id && $login != $row['name']) {
$text .= ' <a href="javascript://" onclick="document.forms[\'form\'].elements[\'text\'].value=\'[b]'.$row['name'].'[\/b],\'">Javob </a>';
$text .= ' | <a href="javascript://" onclick="document.forms[\'form\'].elements[\'text\'].value=\'[c]# ' . $row['name'] . ' (' . functions::display_date($row['mtime']) . ')\n'.mb_substr(bbcode::notags($row['text']), 0, 200).'[\/c]\'">Sit</a>';
}

if ($row['rahmat'] > 0) 
{
$post .=  '<br /><br /> Rahmat aytishti: (' . $row['rahmat'] . ')';
}

$arg = array(
'header' => $text,
'body' => $post,
'sub' => $subtext
);
echo functions::display_user($row, $arg);
echo '</div>';
++$i;
}
//echo '<div class="phdr">Bildirilgan fikrlar: ' . $total . ' ta</div>';
if ($total > $kmess) {
echo '<div class="topmenu">' . functions::display_pagination('index.php?act=comments&amp;id=' . $id . '&amp;', $start, $total, $kmess) . '</div>';
echo '<p><form action="index.php" method="get">
<input type="hidden" name="act" value="comments"/>
<input type="hidden" name="id" value="' . $id . '"/>
<input type="text" name="page" size="2"/>
<input type="submit" value="' . $lng['to_page'] . ' &gt;&gt;"/></form></p>';
}
echo'<div class="phdr"><b>Ulashish</b></div>';
echo '<div class="gray">Yangilik yoqdimi? Do`stlaringiz bilan ulashing:<script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script> <div class="yashare-auto-init" data-yashareL10n="ru"  data-yashareType="none" data-yashareQuickServices="vkontakte,facebook,twitter,odnoklassniki"  ></div></div> ';

} else {
echo '<div class="rmenu">' . $lng_news['message_news_empty'] . '!</div>';
}