Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/12/2010, 23:13
SonrisaCs
 
Fecha de Ingreso: diciembre-2010
Mensajes: 180
Antigüedad: 13 años, 4 meses
Puntos: 5
Respuesta: Crear formulario para subir archivos a mi host

Averr...

files.php
Código PHP:
Ver original
  1. <?php
  2. //  ___  ____       _  ______ _ _        _   _           _  
  3. //  |  \/  (_)     (_) |  ___(_) |      | | | |         | |  
  4. //  | .  . |_ _ __  _  | |_   _| | ___  | |_| | ___  ___| |_
  5. //  | |\/| | | '_ \| | |  _| | | |/ _ \ |  _  |/ _ \/ __| __|
  6. //  | |  | | | | | | | | |   | | |  __/ | | | | (_) \__ \ |_
  7. //  \_|  |_/_|_| |_|_| \_|   |_|_|\___| \_| |_/\___/|___/\__|
  8. //
  9. // by MiniFileHost.co.nr                  version 1.1
  10. ////////////////////////////////////////////////////////
  11.  
  12. include("./config.php");
  13. if(isset($_GET['act'])){$act = $_GET['act'];}else{$act = "null";}
  14. include("./header.php");
  15.  
  16. if($enable_filelist==false){
  17. echo "This page is disabled.";
  18. include("./footer.php");
  19. die();
  20. }
  21. ?>
  22. <center><table style='margin-top:20px;width:790px;height:400px;'><tr><td style='border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;' valign=top>
  23. <h1><center>File List</h1>
  24. <p><table width="100%" cellpadding="0" cellspacing="0" border="0">
  25. <tr><td>#</td><td width="50%"><a href=files.php?sortby=filename style=color:black><b>Filename</b></a></td><td><a href=files.php style=color:black><b>Downloads</b></a></td><td><b>Size</b></td><td><b>Last Download</b></td></tr>
  26. <tr><td colspan=5 height=10></td></tr>
  27. <?php
  28.  
  29. if(isset($_GET['act'])){$act = $_GET['act'];}else{$act = "null";}
  30.  
  31. // Rename PATHTO with the mapname where you keep the config.php
  32. include("./config.php");
  33.  
  34.  
  35. if($enable_filelist == false){
  36. echo "File List Is Disabled.";
  37. die();
  38. }
  39.  
  40. $order = array();
  41. $dirname = "/files/$rand2";
  42. $dh = opendir( $dirname ) or die("couldn't open directory");
  43. while ( $file = readdir( $dh ) ) {
  44. if ($file != '.' && $file != '..' && $file != '.htaccess') {
  45.     $fh = fopen ("./files/".$file, r);
  46.     $list= explode('|', fgets($fh));
  47.     $filecrc = str_replace(".txt","",$file);
  48.     if (isset($_GET['sortby'])) {
  49.         $order[] = $list[1].','.$filecrc.','.$list[5].",".$list[4];
  50.     } else {
  51.         $order[] = $list[5].','.$filecrc.','.$list[1].",".$list[4];
  52.     }
  53.     fclose ($fh);
  54. }
  55. }
  56.  
  57. if (isset($_GET['sortby'])) {
  58.     sort($order, SORT_STRING);
  59. } else {
  60.     sort($order, SORT_NUMERIC);
  61.     $order = array_reverse($order);
  62. }
  63.  
  64. $i = 1;
  65.  
  66. foreach($order as $line)
  67. {
  68.   $line = explode(',', $line);
  69.  
  70. $shourturl==$me;
  71. if ($me=="true")
  72.   $short= "";
  73. else
  74.   $short= "download.php?file=";
  75.  
  76.   if (isset($_GET['sortby'])) {
  77.     echo "<tr><td>".$i."</td><td><a href=\"" . $scripturl . "$me" . $line[1] . "\">".$line[0]."</a></td><td>".$line[2]."</td>";
  78.   } else {
  79.     echo "<tr><td>".$i."</td><td><a href=\"" . $scripturl . "$me" . $line[1] . "\">".$line[2]."</a></td><td>".$line[0]."</td>";
  80.   }
  81.  
  82. // Rename PATHTO with the mapname where you keep the "storage" map
  83.  $filesize = filesize("./storage/".$line[1]);
  84.   $filesize = ($filesize / 1048576);
  85.  
  86.   if ($filesize < 1)
  87.   {
  88.      $filesize = round($filesize*1024,0);
  89.      echo "<td>" . $filesize . " KB</td>";
  90.  
  91.   }
  92.   else
  93.     {
  94.      $filesize = round($filesize,0);
  95.      echo "<td>" . $filesize . " MB</td>";
  96.      
  97.   }
  98. echo "<td>".date('Y-m-d G:i', $line[3])."</td></tr>";
  99. $i++;
  100.  
  101. }
  102. ?>
  103.  
  104. </table></p></center></td></tr></table><p style="margin:3px;text-align:center"><?
  105. include("./footer.php");
  106. ?>

Index.php
Código PHP:
Ver original
  1. <?php
  2.  
  3. include("./config.php");
  4. include("./header.php");
  5.  
  6.  
  7. $sizehosted = 0; //get the storage size hosted
  8. $handle = opendir("./files/");
  9. while($file = readdir($handle)) {
  10. $sizehosted = $sizehosted + filesize ("./files/".$file);
  11.   if((is_dir("./files/".$file.'/')) && ($file != '..')&&($file != '.'))
  12.   {
  13.   $sizehosted = $sizehosted + total_size("./files/".$file.'/');
  14.   }
  15. }
  16. $sizehosted = round($sizehosted/1024/1024,2);
  17.  
  18. if(isset($allowedtypes)){ //get allowed filetypes.
  19.   $types = implode(", ", $allowedtypes);
  20.   $filetypes = "<b>allowed file types:</b> ".$types."<br /><br />";
  21. } else { $filetypes = ""; }
  22.  
  23. if(isset($categories)){ //get categories
  24.   $categorylist = "Category: <select name=\"category\">";
  25.   foreach($categories as $category){
  26.     $categorylist .= "<option value=\"".$category."\">".$category."</option>";
  27.   }
  28.   $categorylist .= "</select><br />";
  29. } else { $filetypes = ""; }
  30.  
  31. if(isset($_GET['page']))
  32.   $p = $_GET['page'];
  33. else
  34.   $p = "0";
  35. include 'total.php';
  36.  
  37. switch($p) {
  38. default: include("./pages/upload.php"); break;
  39. }
  40.  
  41. include("./footer.php");
  42. ?>

Lo sigo en otro coment