<?
/*
* ===========================================*
* 项目: 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( 'page'=>'intval' ) );

	$Year = date( 'Y' );
	$Month = date( 'm' );
	$Day = date( 'd' );
	$StartTime = mktime (0,0,0,$Month,$Day,$Year );
	$EndTime = mktime (0,0,0,$Month,$Day+1,$Year );

	//记录总数
	$Res = mysql_query( " select count(*) as count  from $TableList[ip] where `time` <= $EndTime and `time` >= $StartTime" );
	$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[ip] where `time` <= $EndTime and `time` >= $StartTime ORDER BY `time` DESC LIMIT " . intval( $PageItems[Offset] ) . ", $PageSize " );

	include_once './include.inc/function_timezone.php';
	include_once './include.inc/function_language.php';

	while( $Tmp = mysql_fetch_array( $Res, MYSQL_ASSOC ) )
	{
		$Tmp[language] = GetLanguage( $Tmp[language] );
		$Tmp[timezone] = GetTimeZone( $Tmp[timezone] );
		preg_match( "|http://[^/]+?(/.*)|is", $Tmp[pageurl], $Tmp1 );
		$Tmp[pagesite] = trim( $Tmp1[1] );

		if( $Tmp[firsttime] == $Tmp[lasttime] )
		{
			$Tmp[isfirst] = "<span style='color:red'>*</span>";
		}

		$Datas[] = $Tmp;
	}

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

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

	$Tpl->assign( 'Title', '明细访问 - Ourplus Counter' );
	$Tpl->assign( 'NowView', '明细访问' );
	_out( $Tpl->fetch( 'main.html' )  );
?>