<?
function k_files($dir=null)
{

if ($dir!=null){
$path=(function_exists('iconv'))?iconv('windows-1251', 'utf-8', $dir):$dir;
$path='/'.eregi_replace('^/+|/+$', null, $path).'/';
$all= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `path` LIKE '".mysql_real_escape_string($path)."%'"),0);
$new= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `path` LIKE '".mysql_real_escape_string($path)."%' AND `time` > '".(time()-60*60*24)."'"),0);
}
else
{
$all= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list`"),0);
$new= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `time` > '".(time()-60*60*24)."'"),0);
}

return ($new==0)?$all:"$all/<span class='new'>+$new</span>";
}
?>