View file includes/my.php

File size: 1.48Kb
<?php
// by Mike O. (mides), coolcms.org

switch ($type) {
	case 'blogs':
		$title = 'Блоги';
		$my_what = 'мои записи';
		$seen_row = 'Просмотров';
	break;

	case 'photos':
		$title = 'Фото';
		$my_what = 'мои фото';
		$seen_row = 'Просмотров';
	break;

	case 'loads':
		$title = 'ЗЦ';
		$my_what = 'мои файлы';
		$seen_row = 'Скачиваний';
	break;
}

echo '<div class="title"><a href="index.php">'.$title.'</a>&raquo; '.$my_what.'</div>';
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `$type` WHERE `id_user` = '$u[id]'"), 0);
if ($total > 0) {
	$pages = ceil($total / $config['onpage']);
	if ($page > $pages or $page == 0) {
		$page = 1;
	}
	$begin = ($page - 1) * $config['onpage'];

	$my_r = mysql_query("SELECT * FROM `$type` WHERE `id_user` = '$u[id]' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
	while ($my = mysql_fetch_assoc($my_r)) {
		echo '<div class="row"><a href="index.php?act=view&amp;id='.$my['id'].'">'.$my['name'].' (<b>'.$my['rating'].'</b>)<br />'.$seen_row.': '.$my['seen'].'<br />';
		$comm = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `id_$type` = '$top[id]'"), 0);
		echo 'Коментарий: '.$comm.'<br />';
		echo '</a></div>';
	}
} else {
	echo '<div class="body">Пусто</div>';
}
echo '<div class="body">';
navig($page, '?act=my&amp;', $pages);
echo '<a href="index.php">'.$title.'</a>&raquo; '.$my_what.'</div>';

?>