Location: PHPKode > projects > Serveur Multicartes IPX800 > multicardipx800/TraceLog.php
<?php
require_once('LoadConfig.php');
session_name((string)$GLOBALS["config"]->general->namesession); 
session_start();
require_once("connect_mysql.php");
echo "<h1>Trace du ".$_REQUEST["jour"]."/".$_REQUEST["mois"]."/".$_REQUEST["annee"]."<h1>";
?>
<table border=1>
<tr>
<th>
Heure User.
</th>
<th>
Heure Equipement.
</th>
<?php
if ( !isset($_REQUEST["type"]) )
{
	?>
	<th>
	Type
	</th>
	<?php
}
?>
<th>
Compte
</th>
<th>
IP
</th>
<th>
Texte
</th>
</tr>
<?php
$Luser = array();
$Luser[0] = "Inconnu";
if ( isset($GLOBALS["config"]->users) )
{
	$xpath = "//users/user";
	$ListUser = $GLOBALS["config"]->xpath($xpath);
	foreach($ListUser as $user)
	{ 
		$Luser[(string)$user->attributes()->numero] = $user->label;
	}
}
$noid=1;
$type = $annee = $mois = "";
$select = "SELECT * FROM `trace` WHERE";
if ( isset($_REQUEST["type"]) )
	$select .= " `type` = '".$_REQUEST["type"]."' AND";
//$select .= " time >= ".mktime (0,0,0, $_REQUEST["mois"], $_REQUEST["jour"], $_REQUEST["annee"])." AND time < ".mktime (0,0,0, $_REQUEST["mois"], $_REQUEST["jour"]+1, $_REQUEST["annee"])." ORDER BY `time` ;";
$select .= " mois = ".$_REQUEST["mois"]." and jour=".$_REQUEST["jour"]." and annee=".$_REQUEST["annee"]." ORDER BY `time` ;";

$result = mysql_query($select) or die ('Erreur : '.mysql_error()." -> ".$select ); 
if (!$result) 
{
   echo "Impossible d'exécuter la requête ($sql) dans la base : " . mysql_error();
   exit;
}

if (mysql_num_rows($result) == 0) {
   echo "Aucune ligne trouvée, rien à afficher.";
   exit;
}

while ( $row = mysql_fetch_assoc($result) )
{
//strftime ("%T", convert_utc_time($row["time"], $_SESSION["timezone"]))
$timezone = $row["timezone"];
date_default_timezone_set($_SESSION["timezone"]);
	echo "<tr>
<td>
".date("H:i:s", $row["time"])."
</td>
<td>";
date_default_timezone_set($row["timezone"]);
echo date("H:i:s", $row["time"])." (".$row["timezone"].")
</td>";
if ( ! isset($_REQUEST["type"]) )
	echo "<td>
	".$row["type"]."
	</td>";
echo "<td>
".$Luser[$row["user_id"]]."
</td>
<td>
".long2ip($row["from"])."
</td>
<td>
".$row["texte"]."
</td>
</tr>";
}

?>
</table>
Return current item: Serveur Multicartes IPX800