Hi, everyone. This is my first post and I'm hoping that someone here can help. I'm new to PHP and I'm very close to completing a small project.
<?php
echo "<center>";
echo "<font size=\"5\" color=\"#000000\" face=\"times new roman\"><b>Page Title</b></font>";
echo "</center>";
echo "<center>";
echo "<font size=\"8\" color=\"#000000\" face=\"times new roman\"><b>Bid Requests</b></font>";
echo "<BR>";
echo "<BR>";
$extension = '.txt';
$blank = '';
echo "<font size=\"3\" color=\"#000000\" face=\"arial\">The following bid requests are open at this time:</font>";
echo "<BR>";
echo "<BR>";
echo "<font size=\"3\" color=\"#000000\" face=\"arial\">";
if ($handle = opendir('./bidfolder/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..")
{
echo "<center>";
echo "<b>";
echo htmlspecialchars(ucfirst(preg_replace('/\..*$/', '', $file)));
echo "</b>";
echo "<BR><BR>";
readfile('./bidfolder/' . $file);
echo "<BR><BR>";
echo "<img src='http://www.website.com/images/bidbar.jpg'>";
echo "<BR>";
echo "<BR>";
echo "</center>";
}
}
closedir($handle);
echo "</font>";
}
?>
This code does what I want; it displays the name (minus .txt extension) and contents of text files in a particular folder. But....I need it to sort by date/time with the newest files on top.
Is there an easy way to do this?
Any help is greatly appreciated!