Файл: Dvig/posts.php
Строк: 17
<?php
####################
## Автор - USER-X ##
## Copyright 2013 ##
## xcms.mcdir.ru ##
####################
define('xcms_pro', 1);
$path = '';
include_once ($path . 'core/core.php');
#########
$title='Посты и темы юзера';
include_once ($path . 'core/head.php');
#########
switch($act){
case 'theme':
if($id){
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_themes` WHERE `author_id`='$id'"), 0); }else
{$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_themes` WHERE `author_id`='$users[id]'"), 0); }
$k_page=k_page($total,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
# Все темы
if ($total) {
if($id){$mys = mysql_query("SELECT * FROM `forum_themes` where `author_id`='$id' order by `time` DESC LIMIT $start, $set[p_str]");}else{
$mys = mysql_query("SELECT * FROM `forum_themes` where `author_id`='$users[id]' order by `time` DESC LIMIT $start, $set[p_str]");}
echo'<div id="razd">'.$title.'</div>';
while ($res = mysql_fetch_array($mys)) {
echo'<a id="nav" href="/forum/theme'.$res['id'].'">'.check($res['name']).'
('.mysql_num_rows( mysql_query( "SELECT id FROM `forum_posts` where `theme`='$res[id]'" ) ).')</a>';}
if ($k_page>1)str('/themes'.$id.'/',$k_page,$page); // Вывод страниц
} else {echo '<div id="razd">Тем нет</div>';}
break;
case 'files':
if($id){$id=$id;}else{$id=$users['id'];}
$total = mysql_num_rows(mysql_query("SELECT * from `obmen_files` where `author`='$id'"));
$k_page=k_page($total,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if($total){
$mys = mysql_query("SELECT * FROM `obmen_files` where `author`='$id' order by `time` DESC LIMIT $start, $set[p_str]");
echo'<div id="razd">Файлы пользователя</div>';
while ($res = mysql_fetch_array($mys)) {
echo'<a id="nav" href="/fo/file.php?id='.$res['id'].'">'.check($res['name']).'</a>';}
if ($k_page>1)str('/files'.$id.'/',$k_page,$page); // Вывод страниц
} else {echo '<div id="razd">Файлов нет</div>';}
break;
default:
if($id){
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_posts` WHERE `author`='$id'"), 0); }else
{$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_posts` WHERE `author`='$users[id]'"), 0); }
$k_page=k_page($total,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
# Все посты
if ($total) {
if($id){$mys = mysql_query("SELECT * FROM `forum_posts` where `author`='$id' order by `time` DESC LIMIT $start, $set[p_str]");}else{
$mys = mysql_query("SELECT * FROM `forum_posts` where `author`='$users[id]' order by `time` DESC LIMIT $start, $set[p_str]");}
echo'<div id="razd">'.$title.'</div>';
while ($res = mysql_fetch_array($mys)) {
$them = mysql_fetch_array(mysql_query('SELECT * FROM `forum_themes` WHERE `id`='.$res['theme'].''));
echo'<div id="body">'.check($res['text']).'<br><small>'.clock($res['time']).'</small><br>
В теме : <a href="/forum/theme'.$res['theme'].'">'.check($them['name']).'</a></div>';}
if ($k_page>1)str('/posts'.$id.'/',$k_page,$page); // Вывод страниц
} else {echo '<div id="razd">Постов нет</div>';}
}
#########
include_once ($path . 'core/foot.php');
?>