Файл: soo/forum/new_p.php
Строк: 33
<?
require'../../config.php';
$align='left';
$title='Новое в темах';
aut();
head();
$soo=trim($_GET['soo']);
$comm = mysql_fetch_array(mysql_query('SELECT * FROM `community_comm` WHERE `id` = '.$soo.' LIMIT 1'));
$uchas = mysql_result(mysql_query("SELECT COUNT(uid) FROM `community_user_incomm` where `uid` = '$user[id]' AND `activate` = 1 AND `cid` = '$soo'"),0);
if($comm['status']==2 or $comm['status']==1 && $uchas){
$soo=trim($_GET['soo']);
$comm = mysql_fetch_array(mysql_query('SELECT * FROM `community_comm` WHERE `id` = '.$soo.' LIMIT 1'));
$admin = mysql_fetch_array(mysql_query("SELECT * FROM `community_user_incomm` WHERE `cid` = '$soo' AND `uid` = '".$user['id']."'"));
if(!isset($user)){
echo '<div class="err">Гостям вход запрещён.</div>';
}else if($soo==0 || $soo<0){
echo '<div class="err">Иди нахуй! Хакер недоношеный!</div>';
}else if($soo!=$comm['id']){
echo '<div class="err">Сообщество не найдено.</div>';
}else if(mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_ban` WHERE `id_user` = '$user[id]' AND `id_comm` = '$soo' AND `time` > '$time'"), 0)!=0){
header('Location: ban.php?id='.$soo);
}else{
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post=$db->sql_fetchfield($db->sql_query("SELECT COUNT(*) FROM `comm_forum_t` WHERE `comm_id` = '$soo'"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$q=$db->sql_query("SELECT * FROM `comm_forum_t` WHERE `comm_id` = '$soo' ORDER BY `time` DESC LIMIT $start, $max");
if ($db->sql_numrows($q)==0)echo "Нет сообщенийn";
while ($tem = $db->sql_fetchrow($q))
{
$forum=$db->sql_fetchrow($db->sql_query("SELECT * FROM `comm_forum_f` WHERE comm_id = '$soo' and `id` = '$tem[f_id]' LIMIT 1"));
$razdel=$db->sql_fetchrow($db->sql_query("SELECT * FROM `comm_forum_r` WHERE comm_id = '$soo' and `id` = '$tem[r_id]' LIMIT 1"));
$post=$db->sql_fetchrow($db->sql_query("SELECT * FROM `comm_forum_msg` WHERE comm_id = '$soo' and `t_id` = '$tem[id]' AND `r_id` = '$razdel[id]' AND `f_id` = '$forum[id]' ORDER BY `time` DESC LIMIT 1"));
echo links;
echo "<a href='tema_".$tem['id']."?soo=".$soo."'>$tem[name]</a> <a href='tema_".$tem['id']."_end?soo=".$soo."'>(".$db->sql_fetchfield($db->sql_query("SELECT COUNT(*) FROM `comm_forum_msg` WHERE `f_id` = '$forum[id]' AND `r_id` = '$razdel[id]' AND `t_id` = '$tem[id]'"),0).")</a>";
echo div;
echo "<a href='razdel_".$post['f_id']."?soo=".$soo."'>$forum[name]</a> > <a href='temes_".$post['r_id']."?soo=".$soo."'>$razdel[name]</a><br />n";
echo '<a href="'.H.user_inf($post['user_id']).'">'.user($post['user_id']).'</a> ('.times($post['time']).')<br />'.text($post['msg']).'<br />';
/*$post1=$db->sql_fetchrow($db->sql_query("SELECT * FROM `forum_msg` WHERE `t_id` = '$tem[id]' AND `r_id` = '$razdel[id]' AND `f_id` = '$forum[id]' AND `login` = '$tem[login]' LIMIT 1"));
$ank=$db->sql_fetchrow($db->sql_query("SELECT * FROM `users` WHERE `id` = $tem[login] LIMIT 1"));
echo "Автор: <a href='".H."$ank[id]' title='Анкета "$ank[user]"'>$ank[user]</a> (".date("d.m в H:i", $post1['time']).")<br />n";*/
}
if ($k_page>1){
echo '<br /><dl><dt></dt></dl>';
str("?soo=".$soo."&",$k_page,$page); // Вывод страниц
echo '<br /><dl><dt></dt></dl>';
}
echo '<br />';
echo gb.'<a href="./?soo='.$soo.'">Форум</a>'.div;
foot ();
}
}
?>