Directory Index Sort By Last Uploaded

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Directory Index Sort By Last Uploaded

    Hello,

    I have a directory indexer script that indexes the files in alphabetical order but I need to sort the files by last uploaded. The code is here, can anybody help me please.

    Code:
    <!DOCTYPE html 
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="content-type"
    content="text/html;charset=utf-8" />
    
    <title>
    
    <?php
    include("../includes/config.php");
    ?>
    
    <? echo $conf["site_name"] ?>
    
    
    </title>
        <link rel="stylesheet" href="../includes/style.css" type="text/css"/>
    </head>
    
    <body>
    
    
    
    
    
    <?
    extract($_REQUEST);
    ?>
    
    <?php
    include("../includes/config.php");
    if (!isset($page)) {$page = 0;}
    $total = 0;
    
    if(!($dp = opendir("./"))) die ("Cannot open ./");
    $file_array = array(); 
    while ($file = readdir ($dp))
    {
    if(substr($file,0,1) != &#39;.&#39; and $file != "index.php" and $file != "dl.php" and $file != 
    
    "search.php" and $file != "error.log")
    {
    $file_array[] = $file;
    }
    }
    $file_count = count ($file_array);
    sort ($file_array);
    ?> 
    
    
    
    
      <div class="logo">
    [img]../logo.gif[/img]
    </div>
    <div class="whl"> 
    
    <? echo $conf["site_name"] ?>
    
      </div>
    
    
    
      <div class="title">[img]images/filesave.png[/img] <? echo $conf["welcome_title"] 
    
    ?>
    
    <div class="info"> 
    
    <? echo $conf["welcome_message"] ?>
    
    </div>
    </div>
    
    
     <div class="title">[img]images/filesave.png[/img] <? echo $conf["menu_name"] 
    
    ?>
    
    <div class="info"> 
    
    [img]../images/arrow.png[/img]
    
    <?php
    include("../ads.php");
    ?>
    
    
    
    <?
    
    if ($file_count > 0)
    {
    $first_record = $page * $conf["items_per_page"];
    $last_record = $first_record + $conf["items_per_page"];
    
    while (list($fileIndexValue, $file_name) = each ($file_array))
    {
    
    if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
    {
    
    
    
    echo "<img src=\"../images/dir.gif\" alt=\"*\"/>";
    echo "<a href=\"$file_name\">$file_name</a>  
    ";
    
    }
    }
    
    if (($file_count > 0) AND ($page != 0))
    {
    // previous button
    $prev_page = $page -1;
    echo "
    <a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a>
    ";
    }
    
    
    if (($file_count > 0) AND ($last_record < $file_count))
    {
    // next button
    $next_page = $page + 1;
    echo "
    <a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a>
    ";
    }
    
    
    }
    closedir($dp);
    echo "</small>";
    ?>
    
    </div>
    </div>
    
    
    
    <?php 
    include("../includes/links.php"); 
    ?>
    
    
    
    <p class="info"> 
    [img]../images/con_address.png[/img] 
    [url="../"]Downloads Page[/url]
    </p>
    
    
    <div class="footer">
    <?php 
    include("../includes/online.php"); 
    ?>
    
    
    
    
    <?php
    include("../includes/quiery.php");
    ?>
    
    
    <p class="info2">
    
    <? echo $conf["copy"] ?>
    
    </p>
    
    </div>
      </body>
    </html>
    Thanks.
Working...
X