{% else-1 %}
Функция подсчета файлов в дериктории

                        
<?php
function count_files($dir) {
$total = 0;
$total_new = 0;
$path = opendir($dir);
while ($file = readdir($path)) {
if ($file != ".htaccess" && $file != ".." && $file != ".") {
$total++;
$fmtime = filemtime($dir."/".$file) + (3600 * 24 * 1);
if ($fmtime > time()) {
$total_new++;
}}}
if ($total_new > 0) {
$count_files = (int)$total.'/<span style="color:red">+'.(int)$total_new.'</span>';
} else {
$count_files = (int)$total;
}
closedir($path);
return $count_files;
}
0 42 0
Без комментариев...