list dir contents:
<html>
<body>
<table>
<?
$path = "/full/path/to/dir/";
$dir=opendir($path);
while ($file = readdir ($dir)) {
if ($file != "." && $file != ".." && eregi(".log",$file)) {
echo "<tr><td><a href=\"$file\">View $file</a></td></tr>";
}
}
closedir($dir);
?>
</table>
</body>
</html>
parse log file into table:
<?
$logola = "/full/path/to/file.log";
$referersola = array();
$ipsola = array();
$fd = fopen("$logola","r");
while ($lineola = fgets($fd,1024)) {
// and this depends on your log file format and what you want to see
list( $ipola , , , , , , , , , , $refererola , ) = explode(" ", $lineola);
array_push($referersola, $refererola);
array_push($ipsola, $ipola);
}
$count_end = count($ipsola);
$count_start = max(0,$count_end - 5000); // or whatever
echo "<html><body><div align=center><table border=1>";
echo "<tr><td colspan=2 align=center><font face=verdana><b>Count Start at Line:</b> $count_start <b>Count End at Line:</b> $count_end</font></td></tr>";
for ($i=$count_start;$i<$count_end;$i++){
// and then exclude whatever
if ((!eregi("^111.",$ipsola[$i])) && (!eregi("^222.",$ipsola[$i])) && (!eregi("^333.",$ipsola[$i]))) {
echo "<tr><td><font face=verdana><b>IP:</b> " . $ipsola[$i] . "</font></td><td><font face=verdana><b>Referer:</b> " . $referersola[$i] . "</font></td></tr>";
}
}
echo "</table></div></body></html>";
fclose($fd);
?>
just do a little editing to get the 1st to call the 2nd.