<?php
if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}
global $tracker_lang;
$blocktitle = $tracker_lang ['attendance'];
$content = ReadCache ( 'statcount', true );
if (! $content) {
	$dt24 = gmtime () - 86400;
	$dt24 = sqlesc ( get_date_time ( $dt24 ) );
	$dt7 = gmtime () - 604800;
	$dt7 = sqlesc ( get_date_time ( $dt7 ) );
	$dt30 = gmtime () - 2678400;
	$dt30 = sqlesc ( get_date_time ( $dt30 ) );
	$dt356 = gmtime () - 31536000;
	$dt356 = sqlesc ( get_date_time ( $dt356 ) );
	$dtall = gmtime () - 315360000;
	$dtall = sqlesc ( get_date_time ( $dtall ) );
	$result = sql_query ( "SELECT SUM(last_access >= $dt24) AS totalol24, SUM(last_access >= $dt7) AS totalol7, SUM(last_access >= $dt30) AS totalol30, SUM(last_access >= $dt356) AS totalol356, SUM(last_access >= $dtall) AS totalolall FROM users" ) or sqlerr ( __FILE__, __LINE__ );
	
	while ( $row = mysql_fetch_array ( $result ) ) {
		$totalonline24 = $row ["totalol24"];
		$totalonline7 = $row ["totalol7"];
		$totalonline30 = $row ["totalol30"];
		$totalonline356 = $row ["totalol356"];
		$totalonlineall = $row ["totalolall"];
	}
	
	$content .= "<center>
<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\" class=\"main\" width=\"80%\">
<tr><td class=\"a\" align=\"left\">" . $tracker_lang ['per_day'] . "</td><td class=\"a\" align=\"right\">$totalonline24</td></tr>
<tr><td class=\"b\" align=\"left\">" . $tracker_lang ['per_week'] . "</td><td class=\"b\" align=\"right\">$totalonline7</td></tr>
<tr><td class=\"a\" align=\"left\">" . $tracker_lang ['per_month'] . "</td><td class=\"a\" align=\"right\">$totalonline30</td></tr>
<tr><td class=\"b\" align=\"left\">" . $tracker_lang ['per_year'] . "</td><td class=\"b\" align=\"right\">$totalonline356</td></tr>
<tr><td class=\"a\" align=\"left\">" . $tracker_lang ['per_all_time'] . "</td><td class=\"a\" align=\"right\">$totalonlineall</td></tr>
</table>
</center>";
	$content = WriteCache ( $content );
}
?>