Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.01 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <title>Download</title>
  4.         <link rel="icon" type="image/ico" href="icon.ico">
  5.     </head>
  6. <body>
  7.    
  8.     <?php
  9.  
  10. $myDirectory = opendir("_Download");
  11.  
  12. while(false !== ($entry = readdir($myDirectory))) {
  13.     $dirArray[] = $entry;
  14. }
  15.  
  16. closedir($myDirectory);
  17.  
  18. $indexCount = count($dirArray);
  19.  
  20. sort($dirArray);
  21.  
  22. print("<TABLE border=1 cellpadding=10 cellspacing=0 class=whitelinks>\n");
  23. print("<TR><TH>Filename</TH><th>Filesize</th></TR>\n");
  24.  
  25. for($index=0; $index < $indexCount; $index++) {
  26.        if (substr("$dirArray[$index]", 0, 1) != "."){
  27.         print("<TR><TD><a href=\"_Download/$dirArray[$index]\">$dirArray[$index]</a></td>");
  28.         print("<td>");
  29.         $size = filesize("_Download/$dirArray[$index]");
  30.         $size = $size/1024/1024;
  31.         $size = number_format($size, 2);
  32.         print("$size MB");
  33.         print("</td>");
  34.         print("</TR>\n");
  35.     }
  36. }
  37.    
  38.     ?>
  39.    
  40. </body>
  41. </html>
  42.  
  43. <?php
  44. function Redirect($url, $permanent = false)
  45. {
  46.    header('Location: ' . $url, true, $permanent ? 301 : 302);
  47.  
  48.    exit();
  49. }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement