Location: PHPKode > projects > XmlWeblication > weblication/modules/logdisplay.php
<?php

function module_logdisplay() {

  global $aid, $cfg, $app, $logfile;
	
	if ( ! isset( $logfile ) ) {
	  $logfile = $cfg["logfile"];
	}
	
	if ( $logfile == "" ) return("");
	
	
	if ( ! file_exists($logfile)) {
	  return( $logfile . " not exists");
	}
	
	$f = popen( "tail -1000 ". $logfile . "| grep -i weblication" , "r" );
	if ( ! $f ) {
	  return( "Couldn't tail $logfile" );
	}
	else {
	  $rc .= "<p class=small><b>latest visitors</b><br><br>";
	  while ( $l = fgets( $f, 1024 )) {
		
		  $la = split( " ",$l);
			
			$source = $la[0];
			$time   = $la[3];
		
			$access[$source] = $time;
			
		}
	  pclose($f);
		
		
		reset($access);
		while( list($server,$time) = each( $access)) {
		  $rc .= str_replace("[","",$server . " last access " . $time . "<br><br>");
		}
		
	}
	
  return( $rc );
}



?>
Return current item: XmlWeblication