Código PHP:
Ver original
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Ash Young <[email protected]>. www.evoluted.net */ $startdir = '.'; $showthumbnails = true; $showdirs = true; $forcedownloads = false; 'dlf', 'index.php', 'Thumbs', '.htaccess', '.htpasswd' ); $displayindex = false; /* Allow uploads? - If enabled users will be able to upload files to any viewable directory. */ $allowuploads = true; $overwrite = false; 'index.html', 'index.htm', 'default.htm', 'default.html' ); 'png' => 'jpg.gif', 'jpeg' => 'jpg.gif', 'bmp' => 'jpg.gif', 'jpg' => 'jpg.gif', 'gif' => 'gif.gif', 'zip' => 'archive.png', 'rar' => 'archive.png', 'pdf' => 'pdf.gif', 'rar' => 'rar.gif', ); /* Only edit what is below this line if you are sure that you know what you are doing! */ $leadon = $startdir; if($leadon=='.') $leadon = ''; $startdir = $leadon; if($_GET['dir']) { //check this is okay. $_GET['dir'] = $_GET['dir'] . '/'; } $dirok = true; $dotdotdir = $dotdotdir . $dirnames[$di] . '/'; } if($dirnames[$di] == '..') { $dirok = false; } } $dirok = false; } if($dirok) { $leadon = $leadon . $_GET['dir']; } } if($_GET['download'] && $forcedownloads) { } } if($allowuploads && $_FILES['file']) { $upload = true; if(!$overwrite) { $upload = false; } } if($upload) { } } $opendir = $leadon; if(!$leadon) $opendir = '.'; $opendir = '.'; $leadon = $startdir; } //first see if this file is required in the listing if ($file == "." || $file == "..") continue; $discard = false; $discard = true; } } if($discard) continue; if(!$showdirs) continue; $n++; if($_GET['sort']=="date") { } else { $key = $n; } $dirs[$key] = $file . "/"; } else { $n++; if($_GET['sort']=="date") { } elseif($_GET['sort']=="size") { } else { $key = $n; } $files[$key] = $file; if($displayindex) { } } } } } //sort our files if($_GET['sort']=="date") { } elseif($_GET['sort']=="size") { } else { } //order correctly ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="dlf/styles.css" /> <? if($showthumbnails) { ?> <script language="javascript" type="text/javascript"> <!-- function o(n, i) { document.images['thumb'+n].src = 'dlf/i.php?f='+i; } function f(n) { document.images['thumb'+n].src = 'dlf/trans.gif'; } //--> </script> <? } ?> </head> <body> <div id="container"> <div id="logo"><img src="" alt="logo" width="800" height="150" longdesc="logotipo de la empresa" /></div> <h1>Directory Listing of <div id="breadcrumbs"> <a href="<?=$_SERVER['PHP_SELF'];?>">Principal [Home]</a> <? $sofar = ''; for($bi=0;$bi<($bsize-1);$bi++) { $sofar = $sofar . $breadcrumbs[$bi] . '/'; echo ' > <a href="'.$_SERVER['PHP_SELF'].'?dir='.urlencode($sofar).'">'.$breadcrumbs[$bi].'</a>'; } } $baseurl = $_SERVER['PHP_SELF'] . '?dir='.$_GET['dir'] . '&'; $fileurl = 'sort=name&order=asc'; $sizeurl = 'sort=size&order=asc'; $dateurl = 'sort=date&order=asc'; switch ($_GET['sort']) { case 'name': if($_GET['order']=='asc') $fileurl = 'sort=name&order=desc'; break; case 'size': if($_GET['order']=='asc') $sizeurl = 'sort=size&order=desc'; break; case 'date': if($_GET['order']=='asc') $dateurl = 'sort=date&order=desc'; break; default: $fileurl = 'sort=name&order=desc'; break; } ?> </div> <div id="listingcontainer"> <div id="listingheader"> <div id="headerfile"><a href="<?=$baseurl . $fileurl;?>">Archivo [File]</a></div> <div id="headersize"><a href="<?=$baseurl . $sizeurl;?>">Tamaño</a></div> <div id="headermodified"><a href="<?=$baseurl . $dateurl;?>">Última actualización [Last update]</a></div> </div> <div id="listing"> <? $class = 'b'; if($dirok) { ?> <? if($class=='b') $class='w'; else $class = 'b'; } for($i=0;$i<$arsize;$i++) { ?> <? if($class=='b') $class='w'; else $class = 'b'; } for($i=0;$i<$arsize;$i++) { $icon = 'unknown.png'; $thumb = ''; $thumb = '<span><img src="dlf/trans.gif" alt="'.$files[$i].'" name="thumb'.$i.'" /></span>'; $thumb2 = ' onmouseover="o('.$i.', \''.urlencode($leadon . $files[$i]).'\');" onmouseout="f('.$i.');"'; } if($filetypes[$ext]) { $icon = $filetypes[$ext]; } $filename = $files[$i]; } $fileurl = $leadon . $files[$i]; if($forcedownloads) { } ?> <? if($class=='b') $class='w'; else $class = 'b'; } ?></div> <? if($allowuploads) { switch($last) { case 'g': $phpmaxsize *= 1024; case 'm': $phpmaxsize *= 1024; } ?> <div id="upload"> <div id="uploadtitle"><strong>File Upload</strong> (Max Filesize: <?=$phpmaxsize;?>KB)</div> <div id="uploadcontent"> <? if($phpallowuploads) { ?> <form method="post" action="<?=$_SERVER['PHP_SELF'];?>?dir=<?=urlencode($leadon);?>" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" value="Upload" /> </form> <? } else { ?> File uploads are disabled in your php.ini file. Please enable them. <? } ?> </div> </div> <? } ?> </div> </div> </body> </html>
Me va muy bien pero hay un problema. Está permitido [$allowuploads = true;]
No me permite subir un archivo de 8 Mb. He leído en algún sitio que no se permite más de un porcentaje de la capacidad del servidor. Cuando lo cargo este script me pone "Max Filesize: 20480KB"
Saludos.
Caminantejm.