<?php $a = array(); $dir = opendir ("."); while ($file = readdir ($dir)) { if (is_dir($file)) { if($file=="."||$file=="..") continue; $a[]=$file; }} closedir ($dir); $totaldir = count($a); $libdir = array(); $libfile = array(); for ($i = 0; $i < $totaldir; $i++){ $dircc = opendir ("$a[$i]"); while ($file = readdir ($dircc)) { $filtime=filemtime ("$a[$i]/$file"); $filtime=$filtime+(3600*24*5); //Сколько статью считать новой сейчас уст. на 5 суток if($filtime>=$sitetime){ if (ereg(".txt$", "$file")) { $libdir[]=$a[$i]; $libfile[]=$file; }}} closedir ($dircc); } $total = count($libfile); if($total>0){ $start = (int)$_GET['start']; if($start < 0 || $start > $total){$start = 0;} if ($total < $start + $config_liblist){ $end = $total; } else {$end = $start + $config_liblist; } for ($l = $start; $l < $end; $l++){ $siz= file("../library/$libdir[$l]/$libfile[$l]"); $count_lib= count($siz); $stranicy_lib=ceil($count_lib/$config_libpost); if($stranicy_lib==0){$stranicy_lib=1;} echo'<div class=b>'; $c2=$libfile[$l]; $filtime=filemtime ("../library/$libdir[$l]/$libfile[$l]"); $filtime1=$filtime+(3600*24*1); $filtime2=$filtime+(3600*24*3); if($filtime1>=$sitetime){ echo '<img src="../images/img/new.gif" alt="">';} elseif($filtime2>=$sitetime){ echo '<img src="../images/img/new1.gif" alt="">';} else{ echo '<img src="../images/img/new2.gif" alt="">';} $st_name=file_get_contents("../library/$libdir[$l]/$libfile[$l]"); echo ' <b><a href="lib.php?action=count&did='.$libdir[$l].'&fid='.$libfile[$l].'&'.SID.'">'.$lib_name.'</a></b> ('.$stranicy_lib.' стр.)</div><div>'; } } ?>