<table summary='files' border='0' style='border:2px solid black;' align='center'>
<tr>
<td colspan='5' align='center'>
<table summary='cms' border='0' class='cms' style="margin:0px;border:0; border-collapse: collapse;">
<tr>
<td align='center' class='cms_title' colspan='6'>
<?php echo "Documents for $login"; ?> (*.doc, *.xls, *.txt)
</td>
</tr>
<tr>
<th>
Filename
</th>
<th width='300px;'>
Type of Document
</th>
<th width='75x;'>
Size
</th>
<th align='left' width='30px;'>
Edit
</th>
<th align='left' width='30px;'>
Rename
</th>
<th width='30px;'>
Delete
</th>
</tr>
<?php
$dir = "Users/$login/";
$tr="#c0c0c0";
$flag = false;
if (is_dir($dir))
{
if ($handle = opendir($dir))
{
while (false !== ($file = readdir($handle)))
{
$tail=substr($file, -3);
$tail = strtolower($tail);
#other file FILTER
if (($file != "." && $file != ".." && $tail!= "tml" && $tail!="xsl" && $tail !="svg" && $tail != "htm" && $tail !="xml" && $tail !="php" && $tail !=".js" && $tail !="bmp" && $tail !="jpg" && $tail !="peg" && $tail !="png" && $tail !="swf" && $tail != "gif" && $tail != "css"))
{
$type="";
$fs=File_Size($login,$file);
switch($tail) #Define the document
{
case "doc":
$type="Microsoft Word Document";
break;
case "xls":
$type = "Microsoft Excel Spreadsheet";
break;
case "txt":
$type = "Text Document";
break;
case "pdf":
$type = "Portable Document Format (Adobe Acrobat)";
break;
case "csv":
$type="";
break;
case "xlw":
$type="Microsoft Excel Workbook";
break;
default:
$type= strtoupper($tail)." Document";
};
echo "<tr bgcolor='$tr' onmouseover='color_on(this)' onmouseout='color_off(this, \"$tr\");'>";
echo "<td><a href='Users/$login/$file' target='_blank'>$file</a></td>";
echo "<td>$type</td><td>$fs</td>";
echo "<td>";
if ($pref=='t')
echo "<s>Edit</s>";
elseif ($pref=='i')
echo "<img src='Images/edit_g.gif' border='0'/>";
elseif ($pref=='ti')
echo "<img src='Images/edit_g.gif' border='0'/><br/><small><s>Edit</s></small>";
echo "</td>";
echo "<td style='text-align: center;'><a href='?id=rename&file=$file'>";
if ($pref=='t')
echo "Rename";
elseif ($pref=='i')
echo "<img src='Images/rename.gif' border='0'/>";
elseif ($pref=='ti')
echo "<img src='Images/rename.gif' border='0'/><br/><small>Rename</small>";
echo "</a></td>";
echo "<td style='text-align: center;'><a href='?id=delete&file=$file'>";
if ($pref=='t')
echo "Delete";
elseif ($pref=='i')
echo "<img src='Images/delete.gif' border='0'/>";
elseif ($pref=='ti')
echo "<img src='Images/delete.gif' border='0'/><br/><small>Delete</small>";
echo "</a></td>";
echo "</tr>\n";
#Loop for TR colors
if ($tr=="#c0c0c0")
$tr="#ffffff";
elseif ($tr=="#ffffff")
$tr="#c0c0c0";
$flag = true;
}
}
}
}
if ($flag==false)
echo "<tr bgcolor='$tr'><td colspan='6'><i>No Files Exist Yet!</td></tr>";
?>
</table>
<div class='add'>
<b>ADD:</b> <a href='?id=upload'>Upload a Document</a>
</div>
</td>
</tr>
</table>