Просмотр файла include/mindex.php

Размер файла: 6.8Kb
<?
if( in_array($status, array('admin', 'moderator')) )
			{
list($maxOnl, $time) = explode("<>", file_get_contents("online.txt"));
	$online = mysql_result(
	          mysql_query("SELECT COUNT(*)
	                       FROM `session`
	                       WHERE `time` > ".(time() - (10 * 60))), 0);
	if($online > intval($maxOnl))
	{
		fwrite(fopen('online.txt', 'w'), $online.'<>'.date('d.m.y H:i:s'));
	}
	if($version == "wml")
	{
		header('Content-type: text/vnd.wap.wml; charset=utf-8');
		header("Cache-Control: no-cache");
		echo(doctype("".date('H:i')." Модер-форум")."\r\n");
		echo($tag);
		
		if($authorize)
		{
			echo('<a href="./?p=24&amp;v=wml&amp;sid='.$sid.'">Приват');
			
			$private = mysql_result(
			           mysql_query("SELECT COUNT(*)
			                        FROM `private`
			                        WHERE `name`='".$username."'
			                        AND `new`=1
			                        AND `mod`='i'"), 0);
			echo((empty($private) ? ' - 0</a>' : '</a> - <a href="./?p=24&amp;v=wml&amp;sid='.$sid.'&amp;new=1">'.$private.'</a>'));
			echo("<br />\r\n");
			echo('<a href="./?p=0&amp;v=wml&amp;sid='.$sid.'">Общий форум</a> | ');
			if($status == "admin")
			{
				echo('<a href="./?p=27&amp;v=wml&amp;sid='.$sid.'"><b>Админка</b></a> | ');
			}
			if( in_array($status, array('admin', 'moderator')) )
			{
				  echo("<a href='./?p=26&amp;back=" . base64_encode(htmlspecialchars($_SERVER['REQUEST_URI'])) . "&amp;sid=$sid&amp;v=wml'>Бан по нику</a><br />\r\n");
			}
		}
		$pcntt = mysql_fetch_assoc(
		        mysql_query("SELECT COUNT(*) AS cnt, MAX(mposts.time) AS mt
							 FROM mposts
							 LEFT JOIN mthemes
							 ON mposts.id_theme=mthemes.id"));
		echo("<br/>Всего: <b>(".intval($pcntt['cnt']).")</b><br />");
	}
		elseif($version == "xhtml")
		{
			header("Content-type: text/html; charset=utf-8");
			header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
   header("Cache-Control: no-cache, must-relative");
			echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>'.date('H:i').' Модер-форум</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Модер-форум</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
'.$tag.'');
			if($authorize)
			{
				echo('<a href="./?p=24&amp;v=xhtml&amp;sid='.$sid.'">Приват');
				$private = mysql_result(
				           mysql_query("SELECT COUNT(*)
				                        FROM `private`
				                        WHERE `name`='".$username."'
				                        AND `new`=1
				                        AND `mod`='i'"), 0);
				echo((empty($private) ? ' - 0</a><br />' : '</a> - <a href="./?p=24&amp;v=xhtml&amp;sid='.$sid.'&amp;new=1">'.$private.'</a><br />'));
			}
			echo('<a href="./?p=0&amp;v=xhtml&amp;sid='.$sid.'"><b>Общий форум</b></a> | ');
			if($status == "admin")
					{
						echo('<a href="./?p=27&amp;v=xhtml&amp;sid='.$sid.'"><b>Админка</b></a> | ');
					}
					if( in_array($status, array('admin', 'moderator')) )
					{
						 echo("<a href='./?p=26&amp;back=" . base64_encode(htmlspecialchars($_SERVER['REQUEST_URI'])) . "&amp;sid=$sid&amp;v=xhtml'>Бан по нику</a><br />\r\n");
					}
					$pcntt = mysql_fetch_assoc(
		        mysql_query("SELECT COUNT(*) AS cnt, MAX(mposts.time) AS mt
							 FROM mposts
							 LEFT JOIN mthemes
							 ON mposts.id_theme=mthemes.id"));

			if($newPostss < 1)
			{
				$newPostss = '0/';
			}
echo("Всего: <b>(".intval($pcntt['cnt']).")</b><br />");
			echo($tagC);
			echo('</td></tr><tr><td bgcolor="'.$style['text'].'">'.$tag);
		}
		$f = mysql_query("SELECT *
					      FROM mforums
 					      ORDER BY mforums.pos"
 		);
		if (mysql_affected_rows()==0)
		{
		echo("Не создано ни одного подфорума.<br/>\r\n");
		}
	while($forums = mysql_fetch_assoc($f))
	{
		$pcnt = mysql_fetch_assoc(
		        mysql_query("SELECT COUNT(*) AS cnt, MAX(mposts.time) AS mt
							 FROM mposts
							 LEFT JOIN mthemes
							 ON mposts.id_theme=mthemes.id
							 WHERE id_forum=".$forums['id']));
		if($authorize)
		{
			$lastTimeQ = mysql_query("SELECT * FROM `counter`
			                          WHERE `username`='".$username."'
			                          AND `fid`=".$forums['id']);
            $lastTimeR = mysql_fetch_assoc($lastTimeQ);
			$lastTime = $lastTimeR['time'];

			$newPosts = @intval(
			            mysql_result(
			            mysql_query("SELECT COUNT(*)
									 FROM mposts, mthemes
									 WHERE mposts.id_theme=mthemes.id
									 AND id_forum=".$forums['id']."
									 AND mposts.time > '".$lastTime."'
									 AND mposts.name != '".$username."'
									 GROUP BY mthemes.id_forum"), 0)).'/';

			if($newPosts < 1)
			{
				$newPosts = '0/';
			}

		}
		echo(date("d/m H:i", $pcnt['mt'])."<b>(".$newPosts.intval($pcnt['cnt']).")</b><br />\r\n");
		echo('<b><a href="./?p=3&amp;f='.$forums['id'].'&amp;sid='.$sid.'&amp;v='.$version.'">'.$forums['name'].'</a></b><br /> <br />');
	}
	$fonl = mysql_query("SELECT nickname FROM `session` WHERE `time` > ".(time() - (10 * 60)));
	$uonl = mysql_num_rows($fonl);
	if($version == "wml")
	{
		echo('<br />');
		if($authorize)
		{
		//echo('<a href="./?p=12&amp;sid='.$sid.'&amp;v=wml">Online: <b>'.intval($uonl).'</b></a><br/>');
}
echo('<a href="./?p=20&amp;v=wml&amp;sid='.$sid.'">Поиск</a><br/>
<a href="./?p=13&amp;sid='.$sid.'&amp;v=wml">Топ-20</a><br/>
<a href="./?p=11&amp;sid='.$sid.'&amp;v=wml">Статистика</a><br/>
<a href="./?p=14&amp;v=wml&amp;sid='.$sid.'">Помощь</a><br/>');
		if($authorize)
		{
			echo('<a href="./?logout=1&amp;v=wml&amp;sid='.$sid.'"><b>Выход</b></a><br/>');
		}
echo($tagC.'
</p></card></wml>');
	}
		elseif($version == "xhtml")
		{
			echo($tagC.'</td></tr>');
			echo("<tr><td bgcolor=\"".$style['bottom']."\">\r\n".$tag);
			if($authorize)
				{
		//echo('<a href="./?p=12&amp;sid='.$sid.'&amp;v=xhtml">Online: <b>'.intval($uonl).'</b></a><br />');
		}
echo('<a href="./?p=20&amp;v=xhtml&amp;sid='.$sid.'">Поиск</a><br/>
<a href="./?p=13&amp;sid='.$sid.'&amp;v=xhtml">Топ-20</a><br/>
<a href="./?p=11&amp;sid='.$sid.'&amp;v=xhtml">Статистика</a><br/>
<a href="./?p=14&amp;v=xhtml&amp;sid='.$sid.'">Помощь</a><br/>');
				if($authorize)
				{
					echo('<a href="./?logout=1&amp;v=xhtml&amp;sid='.$sid.'"><b>Выход</b></a><br/>');
				}
echo($tagC.'</td></tr></table>
</body></html>');
		}}
?>