<?
/*
* ===========================================*
* 项目: 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 count(*) as count  from $TableList[area] where types = $Types" );
	$Count = mysql_fetch_array( $Res, MYSQL_ASSOC );
	$DataCount = $Count[count];

	$PageSize = 20;
	if( $DataCount > 0 )
	{
		include_once ( './include.inc/page.inc.php' );
		$PageItems = MakePageItems ( $DataCount, $PageSize );
		$PageLinks = MakePageLinks ( $PageItems, '记录','条' );
		$Tpl->assign( 'PageLinks', $PageLinks );
	}

	$Res = mysql_query( " select *  from $TableList[area] where types = $Types ORDER BY `counts` DESC LIMIT $PageItems[Offset], $PageSize " );

	while( $Tmp = @mysql_fetch_array( $Res, MYSQL_ASSOC ) )
	{
		preg_match( "|(http://[^/]+?)/.*|isU", $Tmp[lastpage], $LastSite );
		$Tmp[lastsite] = trim( $LastSite[1] );
		$Datas[] = $Tmp;
	}
	$Tpl->assign( 'Datas', $Datas );



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