Ok, I am using the following bit of coding:-
$dirnames="/****/*///*//TPB/messages";
$fileoutput = "/**/*///*/**/TPB/messages/list.php";
$dir = opendir($dirnames);
while($filenames = readdir($dir)){
if(($filenames != ".")&&($filenames != "..")){
if(ereg(".mes",$filenames)){
$lines=file($filenames);
foreach($lines as $line)
{
list($threadnumber,$membername,$title,$posttotal,$starttime,$startdate,$state)=explode("|", $line);
$listoutput[$threadnumber] = "$threadnumber|$membername|$title|$posttotal|$starttime|$startdate\n";
}
}
}
}
rsort($listoutput);
$myfile = @fopen ($fileoutput, "w") or die("Couldn't create file");
while (list ($output) = each ($listoutput)){
@fwrite ($myfile, $output) or die("Couldn't write to file");}
fclose($myfile);
}
And when I run the complete coding I get the following errorr message.
Warning: file("1.mes") - No such file or directory in /****////***/**/TPB/post.php on line 61
Warning: Invalid argument supplied for foreach() in /****////***/**/TPB/post.php on line 62
And line 61/62 is the two lines from above:-
$lines=file($filenames);
foreach($lines as $line)