Просмотр файла index.php

Размер файла: 3.23Kb
<?php
// by mides, 1da.su

require_once 'system/sys.php';
require_once 'system/header.php';

switch ($_GET['act']) {
    default:
		if ($u['id']) {
			tp('Добро пожаловать, '.$u['login']);
			
		} else {
			tp('Добро пожаловать, Гость');
		}
		$news_r = mysql_query("SELECT * FROM `news` ORDER BY `time` DESC LIMIT 1");
		$news = mysql_fetch_assoc($news_r);
		if ($news['id']) {
			$comm = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `news_comm` WHERE `id_news` = '$news[id]'"), 0);
			echo '<a href="news.php?act=view&amp;id='.$news['id'].'"><b>'.$news['title'].'</b></a>: '.date('d.m.y', $news['time']).'<br />';
			mb_internal_encoding('UTF-8');
			echo bb(mb_substr($news['text'], 0, 50)).'...<br /><a href="news.php?act=comm&amp;id='.$news['id'].'">Комментарии</a> ('.$comm.')';
		}
		echo '</div>';
				
		tp('Общение');
		$book = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `book`"), 0);
		$blogs = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `blogs`"), 0);
		$gallery = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `gallery`"), 0);
		echo '<a href="book.php">Гостевая книга</a> ('.$book.')<br />';
		echo '<a href="blogs.php">Блоги</a> ('.$blogs.')<br />';
		echo '<a href="gallery.php">Фотогалерея</a> ('.$gallery.')<br />';
		echo '</div>';
		
		$f_topics = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_topics`"), 0);
		$f_msg = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg`"), 0);
		tp('<a href="forum.php">Форум</a> ('.$f_topics.'/'.$f_msg.')<br />');
		$topics_r = mysql_query("SELECT * FROM `forum_topics` WHERE `last_time` > '".(time()-43200)."' ORDER BY `last_time` DESC LIMIT 4");
			while($t = mysql_fetch_assoc($topics_r)){
				$t_msg = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_topic` = '$t[id]'"), 0);
				$last_page = ceil($t_msg/$config['onpage']);
				$cat = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `forum_cats` WHERE `id` = '$t[id_cat]'"));
				$lastuser = mysql_fetch_assoc(mysql_query("SELECT `id_user` FROM `forum_msg` WHERE `id_topic` = '$t[id]' ORDER BY `time` DESC limit 1"));
				echo '<a href="forum.php?act=topic&amp;id='.$t['id'].'">'.$t['title'].'</a> ('.login($lastuser['id_user']).' <a href="forum.php?act=topic&amp;id='.$t['id'].'&amp;p='.$last_page.'">&raquo;</a>)<br />';
		}
		echo '</div>';
		
		tp('Полезное');
		$loads = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `loads_files`"), 0);
		echo '<a href="loads.php">Загруз-центр</a> ('.$loads.')<br />';
		echo '<a href="info.php">Информация, FAQ</a><br />';
		echo '</div>';
		tp('Другое');
		$ad_r = mysql_query("SELECT * FROM `ad` WHERE `type` = 2 ORDER BY `id`");
		while ($ad = mysql_fetch_assoc($ad_r)) {
			echo '<a href="'.$ad['link'].'">'.$ad['name'].'</a><br />';
		}
		$online = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `online`"), 0);
		echo '<a href="http://1da.su">Wap-хостинг 1da.su</a><br />';
		echo '</div><div class="navigation">&copy; <a href="http://coolcms.mobi">by coolcms</a><br /><a href="online.php">Онлайн ('.$online.')</a></div>';
	break;

}

require_once 'system/tail.php';
?>