Размер файла: 7.33Kb
<?
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&v=wml&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&v=wml&sid='.$sid.'&new=1">'.$private.'</a>'));
echo("<br />\r\n");
if( in_array($status, array('admin', 'moderator')) )
{
echo('<a href="./?p=1&v=wml&sid='.$sid.'"><b>Модер-форум</b></a> | ');
}
if($status == "admin")
{
echo('<a href="./?p=27&v=wml&sid='.$sid.'"><b>Админка</b></a> | ');
}
if( in_array($status, array('admin', 'moderator')) )
{
echo("<a href='./?p=26&back=" . base64_encode(htmlspecialchars($_SERVER['REQUEST_URI'])) . "&sid=$sid&v=wml'>Бан по нику</a><br />\r\n");
}
echo('<br />');
}
$pcntt = mysql_fetch_assoc(
mysql_query("SELECT COUNT(*) AS cnt, MAX(posts.time) AS mt
FROM posts
LEFT JOIN themes
ON posts.id_theme=themes.id"));
echo("Всего: <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&v=xhtml&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&v=xhtml&sid='.$sid.'&new=1">'.$private.'</a><br />'));
}
if( in_array($status, array('admin', 'moderator')) )
{
echo('<a href="./?p=1&v=xhtml&sid='.$sid.'"><b>Модер-форум</b></a> | ');
}
if($status == "admin")
{
echo('<a href="./?p=27&v=xhtml&sid='.$sid.'"><b>Админка</b></a> | ');
}
if( in_array($status, array('admin', 'moderator')) )
{
echo("<a href='./?p=26&back=" . base64_encode(htmlspecialchars($_SERVER['REQUEST_URI'])) . "&sid=$sid&v=xhtml'>Бан по нику</a><br />\r\n");
}
$pcntt = mysql_fetch_assoc(
mysql_query("SELECT COUNT(*) AS cnt, MAX(posts.time) AS mt
FROM posts
LEFT JOIN themes
ON posts.id_theme=themes.id"));
echo("Всего: <b>(".intval($pcntt['cnt']).")</b><br />");
echo($tagC);
echo('</td></tr><tr><td bgcolor="'.$style['text'].'">'.$tag);
}
$f = mysql_query("SELECT *
FROM forums
ORDER BY forums.pos"
);
while($forums = mysql_fetch_assoc($f))
{
$pcnt = mysql_fetch_assoc(
mysql_query("SELECT COUNT(*) AS cnt, MAX(posts.time) AS mt
FROM posts
LEFT JOIN themes
ON posts.id_theme=themes.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 posts, themes
WHERE posts.id_theme=themes.id
AND id_forum=".$forums['id']."
AND posts.time > '".$lastTime."'
AND posts.name != '".$username."'
GROUP BY themes.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");
if($authorize)
{
echo('<b><a href="./?p=2&f='.$forums['id'].'&sid='.$sid.'&v='.$version.'">'.$forums['name'].'</a></b><br /> <br />');
}
else
{
echo('<b><a href="./?p=2&f='.$forums['id'].'&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&sid='.$sid.'&v=wml">Online: <b>'.intval($uonl).'</b></a><br />');
echo('<a href="./?p=20&v=wml&sid='.$sid.'">Поиск</a> |
<a href="./?p=13&sid='.$sid.'&v=wml">Топ-20</a> |
<a href="./?p=11&stat&sid='.$sid.'&v=wml">Статистика</a> |
<a href="./?p=14&v=wml&sid='.$sid.'">Помощь</a> | ');
echo('<a href="./?p=28&logout=1&v=wml&sid='.$sid.'"><b>Выход</b></a><br />');
}
else
{
echo('
<a href="./?p=19&v=wml">Авторизация</a> | ');
echo('<a href="./?p=20&v=wml">Поиск</a> |
<a href="./?p=11&v=wml">Статистика</a> |
<a href="./?p=14&v=wml">Помощь</a><br />');
echo('<center>wml | <a href="./?v=xhtml">html</a><br /></center>');
}
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=19&v=xhtml">Авторизация</a> |
<a href="./?p=20&v=xhtml">Поиск</a> |
<a href="./?p=11&v=xhtml">Статистика</a> |
<a href="./?p=14&v=xhtml">Помощь</a><br />');
echo('<tr><td align="center" bgcolor="'.$style['bottom'].'">
<center><a href="./?v=wml">wml</a> | html<br /></center></td></tr>');
}
else
{
echo('<a href="./?p=12&sid='.$sid.'&v=xhtml">Online: <b>'.intval($uonl).'</b></a><br />');
echo('<a href="./?p=20&v=xhtml&sid='.$sid.'">Поиск</a> |
<a href="./?p=13&sid='.$sid.'&v=xhtml">Топ-20</a> |
<a href="./?p=11&sid='.$sid.'&v=xhtml">Статистика</a> |
<a href="./?p=14&v=xhtml&sid='.$sid.'">Помощь</a> | ');
echo('<a href="./?p=28&logout=1&v=xhtml&sid='.$sid.'"><b>Выход</b></a><br />');
}
echo($tagC.'</td></tr></table>
</body></html>');
}
?>