Просмотр файла forum/stat.php

Размер файла: 2.82Kb
<?
/*
=============================================
 Движок:  SHCMS Engine
=============================================
 Название файла: Форум
=============================================
 Official website: http://shcms.ru
=============================================
 Данный код защищен авторскими правами
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
$shcmsengine['title'] = 'Форум - Моя статистика';
include_once'../template/head.php';
if(!$user_id)
{
errors("Статистика доступна только для пользователей");
include_once'../template/foot.php';
exit;
}
switch($act):

case '':

$them = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_them` WHERE `user_id` = '$user_id'"),0);
$message = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_user` = '$user_id'"),0);


echo '<div class="posts">Мои темы в форуме <strong>'.$them.'</strong>:&nbsp <small><a href="?act=them">Просмотр</a></small></div>';
echo '<div class="posts">Мои посты в форуме <strong>'.$message.'</strong>:&nbsp <small><a href="?act=message">Просмотр</a></small></div>';

break;



case'them':

$thems = mysql_query("SELECT * FROM `forum_them` WHERE `user_id` = '$user_id'");
if(mysql_num_rows($thems) == 0)
{
errors("У вас нет тем на форуме");
include_once'../template/foot.php';
exit;
}
while($them = mysql_fetch_array($thems))
{
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_them` = '$them[id]'"),0);
echo '<div class="posts"><img src="icon/icon_them/them.gif"> <a href="message.php?id='.$them['id'].'">'.$them['name'].'</a><span class="mainforum">'.$count.'</span></div>';

}


break;


case'message':

$mess = mysql_query("SELECT DISTINCT (`id_them`) FROM `forum_mess` WHERE `id_user` = '$user_id'");
if(mysql_num_rows($mess) == 0)
{
errors("У вас нет постов на форуме");
include_once'../template/foot.php';
exit;
}
while($messag = mysql_fetch_array($mess))
{
$thems = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id` = '$messag[id_them]'"));

$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_them` = '$thems[id]' AND`id_user` = '$user_id'"),0);

echo '<div class="posts"><img src="icon/icon_them/them.gif"> <a href="message.php?id='.$thems['id'].'">'.$thems['name'].'</a><span class="mainforum">'.$count.'</span></div>';

}
break;

endswitch;

if($act == false) {
echo '<a class="link_str" href="/forum">В форум</a>';
}else {
echo '<a class="link_str" href="/forum/stat.php">Назад</a>';
}


include_once'../template/foot.php';
?>