<?
/*
* ===========================================*
* 项目: 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[browser] where types = $Types ORDER BY `counts` DESC " );
	while( $Tmp = @mysql_fetch_array( $Res, MYSQL_ASSOC ) )
	{
		$Browser[] = $Tmp;
	}
	if( count( $Browser ) > 0 )
	{
		foreach( $Browser as $Key=>$Val )
		{
			$BrowserCountAll += $Val[counts];
		}
		foreach( $Browser as $Key=>$Val )
		{
			$Browser[$Key][percent] = sprintf("%01.2f", ( $Val[counts]/$BrowserCountAll ) * 100 );
		}
	}
	$Tpl->assign( 'Browser', $Browser );


	//读取操作系统统计
	include_once 'include.inc/function_system.php';
	$Res = mysql_query( " select *  from $TableList[system] where types = $Types ORDER BY `counts` DESC " );
	while( $Tmp = @mysql_fetch_array( $Res, MYSQL_ASSOC ) )
	{
		$Tmp[system] = GetSystem( $Tmp[system] );
		$System[] = $Tmp;
	}
	if( count( $System ) > 0 )
	{
		foreach( $System as $Key=>$Val )
		{
			$SystemCountAll += $Val[counts];
		}
		foreach( $System as $Key=>$Val )
		{
			$System[$Key][percent] = sprintf("%01.2f", ( $Val[counts]/$SystemCountAll ) * 100 );
		}
	}
	$Tpl->assign( 'System', $System );

	$Tpl->assign( 'Main', $Tpl->fetch( 'soft.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' )  );
?>