1 |
<? |
2 |
|
3 |
require("cyclic_arr.class.php"); |
4 |
require("bg_color.class.php"); |
5 |
|
6 |
$nr_lines = 30; |
7 |
|
8 |
$a=new Cyclic_Arr; |
9 |
$a->set_size($nr_lines); |
10 |
|
11 |
$b=new Bg_Color; |
12 |
//$b->colors("#ff8888","#88ff88"); |
13 |
|
14 |
// read file in cyclic array |
15 |
$fd = fopen("/data/store/mimex.log", "r"); |
16 |
while (!feof ($fd)) { |
17 |
$line=fgets($fd, 4096); |
18 |
if ($line != "") $a->push($line); |
19 |
} |
20 |
fclose ($fd); |
21 |
|
22 |
// generate html |
23 |
print "<html><head><title>Press clipping - last $nr_lines items</title></head> |
24 |
<body><table>\n"; |
25 |
$a->prev(); // move to next (oldest one) |
26 |
$html=array(); $old_dir=""; |
27 |
for ($i=0; $i<$nr_lines; $i++) { |
28 |
$url=$a->fetch_rev(); |
29 |
$file=basename($url); |
30 |
if (dirname($url) != $old_dir) { |
31 |
print "<tr".$b->bgcolor()."><td>".implode("</td><td>",$html)."</td></tr>\n"; |
32 |
$old_dir=dirname($url); |
33 |
$html=array(); |
34 |
} |
35 |
$html[]="<a href=\"http://store.pliva.hr/$url\">$file</a>"; |
36 |
} |
37 |
print "</table></body></html>\n"; |
38 |
|
39 |
?> |