View file public_html/template/newforums.php

File size: 1.23Kb
<?php
$filtime=filemtime(BASEDIR."local/forums.dat");

$filtime=$filtime+0;

$ttime=time();

if($ttime>=$filtime){

$uir = opendir (BASEDIR."local/dataforum");

while($uile = readdir ($uir)){

if (( $uile != ".") && ($uile != "..") && ($uile != ".htaccess") && ($uile != "index.php") && !ereg ("topic", "$uile") && !ereg ("mainforum", "$uile")){
$urw[] = ''.date("YmdHis", filemtime(BASEDIR.'local/dataforum/'.$uile.'')).'||'.$uile.'||'.$at[$i].'';

}}

closedir ($uir);

$utal = count($urw);

rsort($urw);

$ufp = fopen(BASEDIR."local/forums.dat","a+");

flock ($ufp,LOCK_EX);

ftruncate($ufp,0);
for ($ic=0; $ic<5; $ic++) {
$sexp = explode("||", $urw[$ic]);
$msg=file(BASEDIR."local/dataforum/$sexp[1]");

$msg=array_reverse($msg);

$dato = explode("|",$msg[0]);

$sexpi=str_replace (".dat","",$sexp[1]);

$udtext[]='&#187; <a href="forum/index.php?fid='.
$dato[8].'&amp;id='.$sexpi.'&amp;">'.$dato[3].'</a>['.nickname($dato[0]).', '.date_fixed($dato[9],"H:i").']';
fputs($ufp,"$udtext[$ic]\r\n");}
fflush ($ufp);
flock ($ufp,LOCK_UN);
fclose($ufp);

chmod ($ufp, 0666);

chmod (BASEDIR."local/forums.dat", 0666);}

$tw = file(BASEDIR."local/forums.dat");

$dattem=implode('',$tw);

$dattem=preg_replace ("|[\r\n]+|si","<br>",$dattem);

echo' '.$dattem.' ';

?>