<?php
	$sPage="stats_visitor";
	require("admin/§lib_inc.php");

	$indice_mois=isset($_REQUEST["indice_mois"])?$_REQUEST["indice_mois"] : -1; 
	$indice_annee=isset($_REQUEST["indice_annee"])?$_REQUEST["indice_annee"] : -1; 
	$indice_jour=isset($_REQUEST["indice_jour"])?$_REQUEST["indice_jour"] : -1; 
	$ip=isset($_REQUEST["ip"])?$_REQUEST["ip"] : -1; 

	$sTitle  = display_lng_text("STATS_VISITOR_TITLE");
	$sTitle .= " ";
	$sTitle .= $indice_jour;
	$sTitle .= "/";
	$sTitle .= $indice_mois;
	$sTitle .= "/";
	$sTitle .= $indice_annee;
	$sTitle .= "<br>";
	$sTitle .= $ip;
	$sTitle .= "<br>";
	$sTitle .= gethostbyaddr($ip);
	require("§menu.php");
?>
<BR>
<P>
<TABLE BORDER WIDTH="95%"><TR bgcolor=lightblue>
<TD><CENTER><B><?php display_lng_text("STATS_REFERENCE") ?></B></CENTER></TD>
<TD><CENTER><B><?php display_lng_text("STATS_BROWSER") ?></B></CENTER></TD>
<TD><CENTER><B><?php display_lng_text("STATS_HOUR") ?></B></CENTER></TD>
<TD><CENTER><B><?php display_lng_text("STATS_PAGE") ?></B></CENTER></TD>
</TR>
<?php
	$old_id="";
	$cpt_lig=0;
	$old_ip=0;
	$debut_jour=mktime(0,0,0,$indice_mois,$indice_jour,$indice_annee);
	$debut_jour_suivant=$debut_jour+3600*24;

	mysql_query("SET OPTION SQL_BIG_SELECTS=1");

	$sql_query="select * from OXG_VISITES WHERE IP='$ip' AND HEURE>'$debut_jour' AND HEURE<'$debut_jour_suivant' order by HEURE";

	$result = mysql_query( $sql_query ) or mysql_die();
	while($row = mysql_fetch_array($result))
	{
		if($old_ip!=$row["IP"])
		{
			$cpt_lig++;
			$old_ip=$row["IP"];
		}
		if($cpt_lig&1)
		{
			echo "<TR BGCOLOR=#CCCCCC>";
		}
		else
		{
			echo "<TR BGCOLOR=#B5B5B5>";
		}
		echo "<TD>$row[PROVENANCE]</TD>";
		echo "<TD>$row[NAVIGATEUR]</TD>";
		echo "<TD>";
		echo date("H:i", $row["HEURE"]);
		echo "</TD>";
		echo "<TD>$row[PAGE]</TD>";
		echo "</TD>";
		echo "</TR>";
	}
?>
</TABLE>
<?php
	affiche_pied_page(false);
?>