$forums=30;
for($f=1; $f<40; $f++)
{
$last=@file("Forum$f/lastnumber.file"); $last=0+chop($last[0]);
$lastss=@file("Forum$f/lastss.txt"); $lastss=0+chop($lastss[0]);
if($last && ($last>$lastss+10 || $lastss==0))
{
echo "Обновление списка топиков форума $f (Новых топиков: ",$last-$lastss,")
";
$lastss=$last+9;
$fo=fopen("Forum$f/index.htm","wt");
fputs($fo,"Страница для индексации форума поисковыми системами [".strftime("%d.%m.%Y %H:%M")."]
\n");
fputs($fo,"
\n");
fputs($fo,"\n
\n");
for($j=0; $j<=intval($lastss/500); $j++)
{
$topd="". 500*$j+1 ."..". 500*($j+1);
fputs($fo,"- Топики $topd\n");
$foc=fopen("Forum$f/index-$j.htm","wt");
fputs($foc,"
Топики $topd
\n");
for($i=0; $i<500; $i++)
{
$n=sprintf("%06d",$i+$j*500+1);
$subdir=sprintf("%04d",intval($n/100));
$dsc=@file("Forum$f/$subdir/$n.cgi"); $dsc=chop($dsc[0]);
//A||||0||Igor||Здорово!:)
list($type,$closed,$post,$orig,$top)=split("\|\|",$dsc);
if(!$top) $top="<Пусто>";
fputs($foc,"$top [$post ответов]
\n");
}
fclose($foc);
@chmod("Forum$f/index-$j.htm",0666);
}
fclose($fo);
@chmod("Forum$f/index.htm",0666);
$fo=fopen("Forum$f/lastss.txt","wt");
fputs($fo, $lastss);
fclose($fo);
@chmod("Forum$f/lastss.txt",0666);
}
}
?>
Список форумов Авиабазы для индексации поисковыми системами echo "[".strftime("%d.%m.%Y %H:%M")."]"?>
for($i=1;$i<$forums;$i++)
if(file_exists("Forum$i/index.htm"))
echo "- Forum$i\n";
?>