<?
/*
* ===========================================*
* 项目: Ourplus网站流量统计分析系统*
* 版本: Bate1*
* 开发: 看海*
* ===========================================*
* Copyright (c) 2004 - 2005*
* 主页: http://stat.ourplus.com*
* 信箱: fantasysisky@hotmail.com*
* 版权信息: 本软体为共享软体(shareware)提供个人网站免费使用，
                作者看海 (stat.ourplus.com) 保留全部权力，受相关法律和国际
				公约保护，请勿非法修改、转载、散播，或用于其他赢利行为，
				并请勿删除版权声明。*
* ===========================================*
*/
	session_start();
	include_once './include.inc/config.inc.php';
	include_once 'session.php';

	include_once './include.inc/conn.db.inc.php';
	include_once './include.inc/global.inc.php';
	include_once './include.inc/tpl.inc.php';
	include_once './include.inc/function.php';

	Initialize( $_GET, array( 'type'=>'intval', 'page'=>'intval' ) );

	include_once 'initmenu.php';

	//读取屏幕大小
	$Res = mysql_query( " select *  from $TableList[screen] where types = $Types ORDER BY `counts` DESC " );
	while( $Tmp = @mysql_fetch_array( $Res, MYSQL_ASSOC ) )
	{
		$ScreenSize[] = $Tmp;
	}

	if( count( $ScreenSize ) > 0 )
	{
		foreach( $ScreenSize as $Key=>$Val )
		{
			$ScreenSizeCountAll += $Val[counts];
		}
		foreach( $ScreenSize as $Key=>$Val )
		{
			$ScreenSize[$Key][percent] = sprintf("%01.2f", ( $Val[counts]/$ScreenSizeCountAll ) * 100 );
		}
	}

	$Tpl->assign( 'ScreenSize', $ScreenSize );

	//读取屏幕颜色
	$Res = mysql_query( " select *  from $TableList[color] where types = $Types ORDER BY `counts` DESC " );
	while( $Tmp = @mysql_fetch_array( $Res, MYSQL_ASSOC ) )
	{
		$Color[] = $Tmp;
	}

	if( count( $Color ) > 0 )
	{
		foreach( $Color as $Key=>$Val )
		{
			$ColorCountAll += $Val[counts];
		}
		foreach( $Color as $Key=>$Val )
		{
			$Color[$Key][percent] = sprintf("%01.2f", ( $Val[counts]/$ColorCountAll ) * 100 );
		}
	}

	$Tpl->assign( 'Color', $Color );

	$Tpl->assign( 'Main', $Tpl->fetch( 'screen.html' ) . $ScriptCode );

	$Tpl->assign( 'Title', '屏幕统计 - Ourplus Counter' );
	$Tpl->assign( 'NowView', '屏幕统计' );
	$Tpl->assign( 'QuickLink', "<a href=\"?type=1\">今日详情</a> <a href=\"?type=2\">昨日详情</a> <a href=\"?type=0\">所有详情</a>" );
	_out( $Tpl->fetch( 'main.html' )  );
?>