<?php
define( "ISCNSTATS", "1" );
error_reporting( E_ALL ^ E_NOTICE );
include dirname( dirname( __FILE__ ) ) . "/config.php";
include dirname( dirname( __FILE__ ) ) . "/includes/functions.php";
include dirname( dirname( __FILE__ ) ) . "/includes/db.php";
$GLOBALS["cnstats_db"]->_74cff91f( $STATS_CONF["sqlhost"], $STATS_CONF["sqluser"], $STATS_CONF["sqlpassword"], $STATS_CONF["dbname"] );
$_b3948513 = _7c8375c6();
if ( $COUNTER["disablepassword"] != "yes" ) {
	if ( !$_b3948513 ) {
		header( "Location: ../" );
		exit;
	} 
} 
$_8f0e9156 = intval( $STATS_CONF["slow_reports_time_limit"] );
if ( $_8f0e9156 == 0 )$_8f0e9156 = 600;
$_2472e8fa["ignore_errors"] = true;
@set_time_limit( $_8f0e9156 );
if ( isset( $STATS_CONF["slow_reports_memory_limit"] ) ) {
	@ini_set( "memory_limit", $STATS_CONF["slow_reports_memory_limit"] );
} 
$_2472e8fa["ignore_errors"] = false;
$_fa9c0ab8 = ini_get( "memory_limit" );
if ( strtoupper( substr( $_fa9c0ab8, -1 ) == "M" ) )$_fa9c0ab8 = substr( $_fa9c0ab8, 0, -1 ) * 1024 * 1024;
if ( strtoupper( substr( $_fa9c0ab8, -1 ) == "K" ) )$_fa9c0ab8 = substr( $_fa9c0ab8, 0, -1 ) * 1024;
$_e11ea13e = true;
function _2228f6a0()
{
	GLOBAL $_f76c4060, $_6908d5c3, $_d44298a0;
	$_8c1a452f = 100;
	if ( $_d44298a0["count"] ) {
		$_8c1a452f -= 10;
	} 
	if ( count( $_f76c4060[0] ) != 0 )$_8c1a452f = intval( $_8c1a452f / count( $_f76c4060[0] ) );
	print"<table cellspacing=\"0\" cellpadding=\"5\" border=\"0\" style=\"border-collapse:collapse;margin-bottom:10pt;\" width=\"100%\">\n";
	print"<cols>\n";
	for( $_e66c3671 = 0;$_e66c3671 < count( $_f76c4060[0] );$_e66c3671++ )print"<col width=\"" . $_8c1a452f . "%\">\n";
	if ( $_d44298a0["count"] )print"<col width=\"10%\">\n";
	print"</cols>\n";
	for( $_e66c3671 = 0;$_e66c3671 < count( $_6908d5c3 );$_e66c3671++ ) {
		if ( !is_array( $_f76c4060[$_e66c3671] ) )$_f76c4060[$_e66c3671] = Array( 0 => $_f76c4060[$_e66c3671] );
		print"<tr>\n";
		for( $_7f6567cb = 0;$_7f6567cb < count( $_f76c4060[$_e66c3671] );$_7f6567cb++ ) {
			$_b9ea6d99 = str_replace( "&", "&amp;", $_f76c4060[$_e66c3671][$_7f6567cb] );
			$_b9ea6d99 = str_replace( "&amp;nbsp;", "&nbsp;", $_f76c4060[$_e66c3671][$_7f6567cb] );
			print"<td class=\"print\">" . $_b9ea6d99 . "</td>\n";
		} 
		if ( $_d44298a0["count"] ) {
			if ( $_e66c3671 >= $_d44298a0["header"] ) {
				print"<td class=\"cprint\">" . intval( $_6908d5c3[$_e66c3671] ) . "</td>\n";
			} 
		} 
		print"</tr>\n";
	} 
	print"</table>\n";
} 
$_12a38def = $_GET["st"];
if ( empty( $_12a38def ) )$_12a38def = "attendance";
if ( !preg_match( "/^([a-zA-Z0-9_]+)$/", $_12a38def ) )$_12a38def = "attendance";
if ( !file_exists( "../reports/" . $_12a38def . ".php" ) )$_12a38def = "attendance";
if ( isset( $_GET["sd"] ) ) {
	$_d1a6ae0c = strtotime( $_GET["sd"] );
	$_cb4bcf97 = strtotime( $_GET["fd"] );
} else {
	$_d1a6ae0c = intval( $_GET["stm"] );
	$_cb4bcf97 = intval( $_GET["ftm"] );
	if ( $_d1a6ae0c == 0 ) {
		$_d1a6ae0c = mktime( 0, 0, 0, date( "m" ), date( "d" ), date( "Y" ) ) + $COUNTER["timeoffset"];
		$_cb4bcf97 = mktime( 23, 59, 59, date( "m" ), date( "d" ), date( "Y" ) ) + $COUNTER["timeoffset"];
	} 
} 
header( "Content-Type: text/html" );
$_25f99522 = "_2228f6a0";
_0e5ea304();
$_b3948513 = _7c8375c6();
$_6c09ff9d = $GLOBALS["cnstats_db"]->_24bdb5eb( "SELECT * FROM " . $STATS_CONF["sqlprefix"] . "config" );
if ( $_6c09ff9d ) {
	$_2472e8fa = $GLOBALS["cnstats_db"]->_ef336f8e( $_6c09ff9d );
	$GLOBALS["cnstats_db"]->_d8902be8( $_6c09ff9d );
} 
_6354eb79();
$_eb9e3126 = date( "Y-m-d H:i:s", intval( $_d1a6ae0c ) );
$_9174ebfd = date( "Y-m-d H:i:s", intval( $_cb4bcf97 ) );
print"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
print"<HTML dir=\"" . $LANG["html direction"] . "\">\n";
print"<HEAD>\n";
print"<TITLE></TITLE>\n";
print"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=" . $LANG["charset"] . "\">\n";
print"<STYLE type=\"text/css\">\n";
print".print {border: solid 1px gray;}\n";
print".cprint {border: solid 1px black;text-align:right}\n";
print"</STYLE>\n";
print"</HEAD>\n";
print"<BODY bgcolor=\"white\">\n";
if ( $_f691ecd2 == "guest" && !$_2215f6a3[$_12a38def] ) {
	print$LANG["no access"];
} else {
	_35877304();
	$_f525202d = _32b0dc64();
	$_7fc45f1d = intval( $_GET["filter"] );
	$_dd5afb87 = intval( $_GET["slide"] );
	if ( isset( $_GET["robots"] ) )$_bcb1c214 = intval( $_GET["robots"] );
	else {
		$_a897d92c = "";
		switch ( $_2472e8fa["robots_or_users"] ) {
			case "robots":$_bcb1c214 = 2;
				$_a897d92c = "&amp;robots=2";
				break;
			case "users":$_bcb1c214 = 1;
				$_a897d92c = "&amp;robots=1";
				break;
			default:$_bcb1c214 = 0;
				$_a897d92c = "";
				break;
		} 
	} 
	ob_start();
	if ( preg_match( "/^([a-zA-Z0-9_]+)$/", $_12a38def ) )include"../reports/" . $_12a38def . ".php";
	$_98dd4acc = ob_get_contents();
	ob_end_clean();
	if ( isset( $LANG["reports"][$_12a38def] ) )print"<H2>" . $LANG["reports"][$_12a38def] . "</H2>";
	else for( $_7f6567cb = 0;$_7f6567cb < count( $_4b90d727 );$_7f6567cb += 5 )if ( $_12a38def == $_4b90d727[$_7f6567cb + 2] )print"<h2>" . $_4b90d727[$_7f6567cb + 4] . "</h2>\n";
	print$_02878b94;
	if ( $_e11ea13e )print"<P>" . $LANG["report for period from"] . " " . date( $_2472e8fa["datetime_format"], strtotime( $_eb9e3126 ) ) . " " . $LANG["till"] . " " . date( $_2472e8fa["datetime_format"], strtotime( $_9174ebfd ) ) . "</P>";
	print$_98dd4acc;
	if ( is_file( "../version.txt" ) ) {
		$_98dd4acc = file( "../version.txt" );
		$_bda0f2db = htmlspecialchars( trim( substr( $_98dd4acc[1], 7 ) ) );
	} else$_bda0f2db = 0;
	print"<hr size=1>" . strip_tags( str_replace( "%%%BUILD%%%", $_bda0f2db, $_085742f1 ) );
	$_365e0470 = _32b0dc64();
	$_95cc2cae = $_365e0470 - $_f525202d;
} 
print"</BODY>\n";
print"</HTML>\n";

?>