<?php
if (!defined('BLOCK_FILE')) {
	Header("Location: ../index.php");
	exit;
}

include("config/config_bots.php");
global $prefix, $db;

// BLOK 1

$m = "";
$u = "";
$i = "";
$b = "";
$result = $db->sql_query("SELECT uname, guest, module, UNIX_TIMESTAMP(now())-time AS time, u_a FROM ".$prefix."_session ORDER BY uname");
while (list($uname, $guest, $module, $time, $u_a) = $db->sql_fetchrow($result)) {
	$linkstrip = ereg_replace("_", " ", cutstr($module, 10));
	if ($guest == 0) {
		$title_who = "<tr><td><a href=\"index.php?name=Account&op=info&uname=$uname\" title=\"".displayTime($time)."\">$uname</a></td><td align=\"right\">$linkstrip</td></tr>";
		$m++;
	} else {
		$title_who = "";
		$u++;
		if ($bots_check == 1) {
			$bots = file_get_contents("config/bots.dat");
			$bots_array = explode("\n", $bots);
			for ($k=0; $k< count($bots_array); $k++) {
				$bots_data = explode("=", $bots_array[$k]);
				if (eregi($bots_data[0], $u_a)) {
					$title_who = "<tr><td><div title=\"".displayTime($time)."\">".cutstr($bots_data[1], 15)."</div></td><td align=\"right\">$linkstrip</td></tr>";
					$b++;
					$u--;
				}

			}
		}
	}
	$who_online[$guest] .= $title_who;
	$i++;
}


if ($m == "") $m = 0;
if ($u == "") $u = 0;
if ($i == "") $i = 0;
if ($b == "") $b = 0;
$content .= "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr valign=\"middle\"><td colspan=\"2\" align=\"center\"><b>"._BVISIT."</b></td></tr>";
$content .= "<tr><td><img src=\"images/blocks/member.gif\" title=\""._BMEM."\" alt=\""._BMEM."\" /></td><td>"._BMEM.": $m</td></tr>";
$content .= "<tr><td><img src=\"images/blocks/anony.gif\" title=\""._BVIS."\" alt=\""._BVIS."\" /></td><td>"._BVIS.": $u</td></tr>";
if ($bots_check == 1) $content .= "<tr><td><img src=\"images/blocks/bots.gif\" title=\""._BBOTS."\" alt=\""._BBOTS."\" /></td><td>"._BBOTS.": $b</td></tr>";
$content .= "<tr><td><img src=\"images/blocks/group.gif\" title=\""._OVERALL."\" alt=\""._OVERALL."\" /></td><td>"._OVERALL.": $i</td></tr></table>";
if ($who_online[0] != "") $content .= "<hr><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr><td align=\"center\" colspan=\"2\"><b>"._BMEMVISIT."</b></td></tr><tr><td><noindex><table width=\"100%\" border=\"0\">$who_online[0]</table></noindex></td></tr></table>";
if ($bots_check == 1) if ($who_online[1] != "") $content .= "<hr><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr><td align=\"center\" colspan=\"2\"><b>"._BOTSON."</b></td></tr><tr><td><noindex><Marquee Behavior=\"Scroll\" Direction=\"up\" Height=\"30\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><table width=\"100%\" border=\"0\">$who_online[1]</table></Marquee></noindex></td></tr></table><hr>";



// BLOK 2

list($sumfiles) =      $db->sql_fetchrow($db->sql_query("SELECT count(*) FROM ".$prefix."_files"));
$result = $db->sql_query($sql);

list($sumnews) =       $db->sql_fetchrow($db->sql_query("SELECT count(*) FROM ".$prefix."_stories"));
$result = $db->sql_query($sql);

list($sumflashgames) = $db->sql_fetchrow($db->sql_query("SELECT Count(*) FROM ".$prefix."_album_pictures"));
$result = $db->sql_query($sql);

$edinic = $sumfiles+$sumnews+$sumflashgames;

$content .= "
<TABLE width=100% border=0>
<TR><TD width=70%>
Файлов:
</TD>
<TD width=30%>
<div align=right><b>$sumfiles</b></div>
</TD></TR>

<TR valign=top><TD width=70%>
<div>Новостей: </div>
</TD>
<TD width=30%>
<div align=right><b>$sumnews</b> </div>
</TD></TR>

<TR valign=top><TD width=70%>
<div>Флеш игр: </div>
</TD>
<TD width=30%>
<div align=right><b>$sumflashgames</b> </div>
</TD></TR>

<TR valign=top>
<TD width=70%>
<div><br>Итого контента: </div>
</TD>
<TD width=30%><hr>
<div align=right><div><font color=\"#FF0000\"><b>$edinic</b></font></div></div>
</TD></TR>

<TR valign=top>
<TD colspan=\"2\" align=\"center\" valign=\"middle\" onmouseover=this.className=\"alpha100\"  onmouseout=this.className=\"alpha60\" class=\"alpha60\">
<a href=\"http://alfainfo.ru/rss.php\" target=\"_self\">
<img src=\"http://alfainfo.ru/images/rss2.jpg\" width=\"80\" height=\"15\" border=\"0\">
</a></TD></TR>
</table>
<hr>
";

// BLOK 3

$marquee = 1;
$height = 100;
$scrolldirection = "Up";  

if ($marquee!="0")
$content .= "<Marquee Behavior=\"Scroll\" Direction=\"up\" Height=\"100\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";

$open=fopen("blocks/counter.set","r");
$content .= fread($open,filesize("blocks/counter.set"));
fclose($open); 

if ($marquee!="0")
$content .= "</Marquee>";
$content .= "<hr>";
$open=fopen("blocks/counter_1.set","r");
$content .= fread($open,filesize("blocks/counter_1.set"));
fclose($open);

?>
