Файл: soo/forum/my_t.php
Строк: 27
<?
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{
$k_post=$db->sql_fetchfield($db->sql_query("SELECT COUNT(*) FROM `comm_forum_t` where comm_id = '$soo' and `user_id` = '".$user['id']."';"),0);
echo "<b>Мои темы ($k_post)</b><br />";
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' and `user_id` = '".$user['id']."';"),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' and `user_id` = '".$user['id']."' 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"));
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 `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_".$tem['f_id']."?soo=".$soo."'>$forum[name]</a> > <a href='temes_".$tem['r_id']."?soo=".$soo."'>$razdel[name]</a><br />n";
$post = @$db->sql_fetchrow($db->sql_query("select * from `comm_forum_msg` WHERE t_id = '".$tem['id']."' order by time desc limit 1;"));
echo 'Сообщение: <a href="'.H.user_inf($post['user_id']).'">'.user($post['user_id']).'</a>';
echo '('.times($post['time']).')<br />';
}
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 ();
?>