Файл: soo/forum/my_p.php
Строк: 28
<?
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_msg` 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_msg` 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_msg` where comm_id = '$soo' and `user_id` = '".$user['id']."' ORDER BY `time` DESC LIMIT $start, $max");
if ($db->sql_numrows($q)==0) echo "Нет сообщений";
while ($post = $db->sql_fetchrow($q))
{
$them=$db->sql_fetchrow($db->sql_query("SELECT * FROM `comm_forum_t` WHERE comm_id = '$soo' and `id` = '$post[t_id]' LIMIT 1"));
$forum=$db->sql_fetchrow($db->sql_query("SELECT * FROM `comm_forum_f` WHERE comm_id = '$soo' and `id` = '$post[f_id]' LIMIT 1"));
$razdel=$db->sql_fetchrow($db->sql_query("SELECT * FROM `comm_forum_r` WHERE comm_id = '$soo' and `id` = '$post[r_id]' LIMIT 1"));
echo links;
echo "<a href='tema_".$post['t_id']."?soo=".$soo."'>$them[name]</a> <a href='tema_".$post['t_id']."_end?soo=".$soo."'>(".$db->sql_fetchfield($db->sql_query("SELECT COUNT(*) FROM `comm_forum_msg` WHERE `t_id` = '$post[t_id]'"),0).")</a>n";
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 />';
}
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 ();
}}
?>