PHP Classes

File: log.php

Recommend this page to a friend!
  Classes of Mertol   Reduced MySQLi   log.php   Download  
File: log.php
Role: Application script
Content type: text/plain
Description: Script for viewing the log file
Class: Reduced MySQLi
MySQLi database access wrapper
Author: By
Last change:
Date: 15 years ago
Size: 2,589 bytes
 

Contents

Class file image Download
<?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));
 
?>