<?php
/*
* This script prints the log file
* Needs cs-phpxml to run; Can be downloaded from: http://cs-phpxml.sourceforge.net/
*/
include("phpxml/xmlParserClass.php");
$filename = "log.xml"; //Change it if differet
$fh = fopen($filename, 'r') or die("siƧti");
$log_xml = fread($fh, filesize($filename));
$log_xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><log>".$log_xml."</log>";
function print_log($xml){
$xmlParser = new xmlParser($xml);
$log_array = $xmlParser->get_tree(TRUE);
foreach($log_array['LOG'] as $k => $v){
foreach($v as $k => $pg){
/*her page*/
?>
<div style="padding: 10px; margin: 10px; background-color: #EAEBEE;">
<table>
<tr>
<td>
<strong> time: </strong>
</td>
<td>
<?=$pg['DATE'];?>
</td>
</tr>
<tr>
<td>
<strong> ip </strong>
</td>
<td>
<?=$pg['IP'];?>
</td>
</tr>
<tr>
<td>
<strong> browser </strong>
</td>
<td>
<?=$pg['BROWSER'];?>
</td>
</tr>
<tr>
<td>
<strong> url </strong>
</td>
<td>
<?=$pg['URL'];?>
</td>
</tr>
<tr>
<td>
<strong> ref </strong>
</td>
<td>
<a href="<?=$pg['REF'];?>"><?=$pg['REF'];?></a>
</td>
</tr>
<tr>
<td>
<strong> memory: </strong>
</td>
<td>
<?=$pg['MEMORY'];?> byte
</td>
</tr>
<tr>
<td>
<strong> sql </strong>
</td>
<td>
<?
foreach($pg['SQL'] as $k => $query){
?><div style="background-color: #bec8ec;padding: 2px;margin-top: 3px;"><?=$query['SQL'];?></div> <strong><?=$query['TIME'];?></strong><?
}
?>
</td>
</tr>
</table>
</div>
<?
}
}
};
print_log($log_xml);
print("peak memory:".(memory_get_peak_usage(true))/(1024*1024));
?>
|