PHP Classes

File: test_logsreader.php

Recommend this page to a friend!
  Classes of Pascal Toussaint   Apache Logs Reader   test_logsreader.php   Download  
File: test_logsreader.php
Role: Example script
Content type: text/plain
Description: ApacheLogVisits example
Class: Apache Logs Reader
Parsing and processing Apache log files
Author: By
Last change:
Date: 20 years ago
Size: 900 bytes
 

Contents

Class file image Download
<?php
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// MODULE: Test class.apache.logs.reader
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// $Id$
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
header("Pragma: no-cache");
header("Cache-Control: no-cache");

require_once(
"class.apache.logs.reader.php");

$log = new ApacheLogVisits("D:\\Serveur Web\\logs\\devel-access_log.log");
$log->SetLogFormat(logformat_combined);

$from = mktime(0,0,0,2,1,2004);
$to = time();

$visit = $log->GetVisits(basename(__FILE__),$from,$to);

print(
$visit[0]." viewed page".(($visit[0]>1)?"s":"")." by ".$visit[1]." visitor".(($visit[1]>1)?"s":"")." between ".date("d/m/Y",$from)." and ".date("d/m/Y",$to));

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?>