Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><? echo ($title) ? ($title) : ("File Upload Manager"); ?></title>
<link rel="stylesheet" href="<?=$dir_img?>/<?=$style?>.css" type="text/css">
<?
if ($auth_ReqPass == 1)
{
if (isset($login) || isset($logout)) {
echo("<meta http-equiv='refresh' content='2;url=index.php?ir=1'>");
}
}
?>
</head>
<body bgcolor="#F7F7F7"><br><br>
<center>
<?
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) {
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
?>
<table width="560" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><font size="3"><b><i><? echo ($title) ? ($title) : ("File Upload Manager"); ?></i></b></font> <font style="text-decoration: bold; font-size: 9px;">v<?=$fum_vers?></font>
<?
#--Please do not remove my link/copyright as it is unfair and a breach of the license--#
echo"<a href=\"http://argkorps.cindario.com\" style=\"text-decoration: none; color: #C0C0C0; font-size: 9px; cursor: default\";>© thepeak</a>";
?>
</td>
</tr>
</table>
<?
if (!eregi("777",decoct(fileperms($dir_store))))
{
echo"<br><br><b><h4><font color=\"FF0000\">ERROR: cannot access the upload store file directory. please chmod the \"$dir_store\" directory with value 0777 (xrw-xrw-xrw)!</h4></font></b><br>»<a href='index.php?ir=1'>refresh</a>"; }
else
{
if (!$_FILES[fileupload])
{
?>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-top:5px;padding-left=5px;padding-bottom:5px;padding-right:5px">
<form method="post" enctype="multipart/form-data">
<tr>
<td>file:</td><td><input type="file" name="fileupload" class="textfield" size="30"></td>
</tr>
<tr>
<td>rename to:</td><td><input type="text" name="rename" class="textfield" size="46"></td>
</tr>
<tr>
<td>file types allowed:</td><td>
<?
for($i=0;$i<count($file_ext_allow);$i++)
{
if (($i<>count($file_ext_allow)-1))$commas=", ";else $commas="";
list($key,$value)=each($file_ext_allow);
echo $value.$commas;
}
?>
</td>
</tr>
<tr>
<td>file size limit:</td>
<td>
<b><?
if ($file_size_ind >= 1048576)
{
$file_size_ind_rnd = round(($file_size_ind/1024000),3) . " MB";
}
elseif ($file_size_ind >= 1024)
{
$file_size_ind_rnd = round(($file_size_ind/1024),2) . " KB";
}
elseif ($file_size_ind >= 0)
{
$file_size_ind_rnd = $file_size_ind . " bytes";
}
else
{
$file_size_ind_rnd = "0 bytes";
}
echo "$file_size_ind_rnd";
?></b>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="upload" class="button"> <input type="reset" value="clear" class="button"></td>
</tr>
</form>
</table>
<?
if ((!$_GET[act]||!$_GET[file])&&$_GET[act]!="delall")
{
$opendir = @opendir($dir_store);
while ($readdir = @readdir($opendir))
{
if ($readdir<>"." && $readdir<>".." && $readdir != "index.html")
{
$filearr[] = $readdir;
}
$sort=array();
for($i=1;$i<=count($filearr);$i++)
{
$key = sizeof($filearr)-$i;
$file = $filearr[$key];
$sort[$i]=$file;
}
asort($sort);
}
?>
<br>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-left:5px">
<tr>
<td><b>admin tools:</b>
<?
if ($file_del_allow != 1 && $auth_ReqPass != 1)
{
echo"<i>none</i>";
}
if ($file_del_allow == 1 && $file_list_allow == 1 && (count($filearr) >= 1))
{
echo"<a href=\"javascript:;\" onClick=\"cf=confirm('Are you sure you want to delete ALL FILES?');if (cf)window.location='?act=delall'; return false;\" style=\"font-size: 9px;\"><delete all files></a>";
}
if ($auth_ReqPass == 1)
{
echo" <a href='index.php?ir=1&logout=1' style=\"font-size: 9px;\"><log-out><a>";
}
?>
</td>
</tr>
</table>
<br>
<?
if ($file_list_allow == 1 && (count($filearr) >= 1))
{
?>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-left:6px">
<tr bgcolor="#DBDBDB">
<td align="left" width="46%">FILE NAME</td>
<td align="center" width="12%">FILE TYPE</td>
<td align="center" width="12%">FILE SIZE</td>
<td align="center" width="30%">FUNCTIONS</td>
</tr>
<?
for($i=1;$i<=count($sort);$i++)
{
list($key,$value)=each($sort);
if ($value)
{
$value_en = base64_encode($value);
$value_view=$value;
if (strlen($value) >= 48)
{
$value_view = substr($value_view, 0, 45) . '...';
}
?>
<tr>
<td width="30%"><?="<a href=\"?act=view&file=$value_en\">$value_view</a>"?></td>
<td align="center" width="5%"><? echo strtoupper(getlast($value)); ?></td>
<td align="center" width="5%"><?
$value_full = $dir_store."/".$value;
$file_size = filesize($value_full);
if ($file_size >= 1048576)
{
$show_filesize = number_format(($file_size / 1048576),2) . " MB";
}
elseif ($file_size >= 1024)
{
$show_filesize = number_format(($file_size / 1024),2) . " KB";
}
elseif ($file_size >= 0)
{
$show_filesize = $file_size . " bytes";
}
else
{
$show_filesize = "0 bytes";
}
echo "$show_filesize";
?></td>
<td align="center" width="5%"><?="<a title=\"View File\" href=\"?act=view&file=$value_en\"><view></a>"?> |
<?
if ($file_del_allow == 1)
{
echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\"><dl></a>";
}
else
{
echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\"><download></a>";
}
if ($file_del_allow == 1)
{
echo" | <a title=\"Delete file\" href=\"javascript:;\" onClick=\"cf=confirm('Are you sure you want to delete this file?');if (cf)window.location='?act=del&file=$value_en'; return false;\"><delete></a>";
}
else
{
echo" ";
}
?>
</td>
</tr>
<?
}
else
{
echo"<br>";
}
}
?>
</table></center>