<HTML>
<HEAD>
<TITLE>File/Backup management screen</TITLE>
<link href='default.css' rel='stylesheet' type='text/css'>
</HEAD>
<BODY>
<?php
$file_dir="ross";
function place($path)
{
<span class='title'>File/backup upload</span><img src="spacer.gif" width='100%' height='10'><br>
<span class='text'>This is an area where you can upload and manage your files for school.<br>To upload the file click browse for the image in your computer and press upload.</span>
<img src="spacer.gif" width='100%' height='7'><br>
<table border='0' bgcolor='#000000' cellpadding='1' cellspacing='1'>
<tr>
<td align='center'>
<table border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>
<tr>
<td align='center' valign='top'><img src="spacer.gif" width='100%' height='15'></td>
</tr>
<tr>
<td align='center'>
<FORM ENCTYPE='multipart/form-data' ACTION='' METHOD='POST'>
File: <INPUT TYPE='FILE' NAME='uploadfile' maxlength='255'>
<INPUT TYPE='hidden' name='action' VALUE='5'>
<INPUT TYPE='hidden' name='path' VALUE='$path'>
</td>
</tr>
<tr>
<td align='center'>
<INPUT TYPE='submit' VALUE='Upload'>
</td></FORM>
</tr>
<tr>
<td align='center' valign='top'><img src="spacer.gif" width='100%' height='15'></td>
</tr>
</table>
</td>
</tr>
</table>
";
}
function place_bottom($path)
{
<span class='title'>Directory Create</span><img src="spacer.gif" width='100%' height='10'><br>
<span class='text'>This is an area where you can create a directory.<br>To create one you type the name in the field and push create.</span>
<img src="spacer.gif" width='100%' height='7'><br>
<table border='0' bgcolor='#000000' cellpadding='1' cellspacing='1'>
<tr>
<td align='center'>
<table border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>
<tr>
<td align='center' valign='top'><img src="spacer.gif" width='100%' height='15'></td>
</tr>
<tr>
<td align='center'>
<FORM ACTION='' METHOD='POST'>
Create directory: <INPUT TYPE='text' NAME='create_dir'>
<INPUT TYPE='hidden' name='action' VALUE='1'>
<INPUT TYPE='hidden' name='path' VALUE='$path'>
</td>
</tr>
<tr>
<td align='center'>
<INPUT TYPE='submit' VALUE='Create'>
</td></FORM>
</tr>
<tr>
<td align='center' valign='top'><img src="spacer.gif" width='100%' height='15'></td>
</tr>
</table>
</td>
</tr>
</table>
";
} // einde place_bottom()
function pics_onsite($path,$DOCUMENT_ROOT,$subdir)
{
{
echo "Error: directory: $path not found....";
}
$count=0;
$list= "<table border='0' cellspacing='1' cellpadding='1' bgcolor='#000000'>
<tr><td valign='top' bgcolor='#FFFFFF'><img src="spacer.gif" width='100%' height='7'><br>";
$directory= "<table border='0' cellspacing='1' cellpadding='1' bgcolor='#000000'>
<tr><td valign='top' bgcolor='#FFFFFF' align='center'><img src="spacer.gif" width='100%' height='7'><br>";
{
$subdir=1;
}
else
{
$subdir=0;
}
while (($file =
readdir($handle))!==
false) {
if (($file != ".") && ($file != ".."))
{
{
$directory.="| <a class='text' href=?action=3&change_path=$path/$file>$file</a> |";
}
{
$list.=
" <a class='text' href=?action=4&file=$file_del&path=$path&subdir=$subdir>[delete]</a> <a class='text' href='" .
ereg_replace("$DOCUMENT_ROOT",
"",
$path) .
"/$file' target='_blank'>$file</a> <br>";
$count++;
if ($count==10){$list.="<img src="spacer.gif" width='100%' height='7'></td><td valign='top' bgcolor='#FFFFFF'><img src="spacer.gif" width='100%' height='7'><br>"; $count=0;}
$wel=1;
}
}
}
if (!$wel){$list.="<center><img src="spacer.gif" width='10' height='7'><span class='textbold'>No files in this directory try another</span><img src="spacer.gif" width='10' height='7'></center>";}
$list.="<img src="spacer.gif" width='100%' height='7'></td></tr></table>";
if ($subdir){$directory.="<a class='text' href=?action=2>| Back |</a>";}
$directory.="<img src="spacer.gif" width='100%' height='7'></td></tr></table>";
<center>
<span class='textbold'>Carefull with the delete function, it wil delete it all (no control).</span>
<table border=0>
<tr>";
{
echo "<td align='center' valign='top' class='text'> You are in directory: <span class='title'>" .
ereg_replace("$DOCUMENT_ROOT/$file_dir",
"",
$path) .
"</span> <a class='text' href=?action=6&del_path=$path>[delete_DIR]</a></td>";
}
else
{
echo "<td align='center' valign='top'><img src="spacer.gif
" width='100%' height='10'></td>";
}
</tr>
<tr>
<td align='center' class='text'>Below you will view list of existing files.</td>
</tr>
<tr>
<td align='center' valign='top'><img src="spacer.gif" width='100%' height='7'></td>
</tr><tr>
<td align='center' valign='top'>$directory</td>
</tr>
<tr>
<td align='center' valign='top'><img src="spacer.gif" width='100%' height='7'></td>
</tr>
<tr>
<td align='center' valign='top'>$list</td>
</tr>
</table>
</center>
";
} // einde pics_onsite()
function delete($file)
{
{
{
while ($filename =
readdir($handle)) {
if ($filename != "." && $filename != "..")
{
delete ($file."/".$filename);
}
}
if (rmdir($file)){$message.=
"Directory: " .
ereg_replace("$path",
"",
$file) .
", deleted<br>";
} }
else
{
}
}
} // einde delete($file)
if (!$path)
{
$path="$DOCUMENT_ROOT/$file_dir";
}
switch ($action)
{
case 1:
$path="$path/$create_dir";
break;
case 2:
$subdir=0;
break;
case 3:
$path="$change_path";
$subdir=1;
break;
case 4:
$message="<br><br><center><table border='0' cellspacing='1' cellpadding='1' bgcolor='#000000'>
<tr><td valign='top' bgcolor='#FFFFFF' class='text'><img src="spacer.gif" width='100%' height='7'><br>";
{
}
ELSE
{
{
unlink ("$path/$file") or
die ("error: $path/$file");
}
}
break;
case 5:
$doel="$path/$uploadfile_name";
IF (!
copy ($uploadfile,
$doel)) {
echo "Error copying: ($uploadfile) to: ($doel)";
}
break;
case 6:
$message="<br><br><center><table border='0' cellspacing='1' cellpadding='1' bgcolor='#000000'>
<tr><td valign='top' bgcolor='#FFFFFF' class='text'><img src="spacer.gif" width='100%' height='7'><br>";
delete($del_path);
$message.="<img src="spacer.gif" width='100%' height='7'></td></tr></table></center>";
break;
}
<center>
<table border='0' bgcolor='#000000' cellpadding='1' cellspacing='1'>
<tr>
<td align='center'>"; place
($path);
echo "<br></td><td align='center'>"; place_bottom
($path);
echo "<br></td> </tr>
<tr>
<td align='center' colspan='2'>"; pics_onsite
($path,
$DOCUMENT_ROOT,
$subdir);
echo "</td> </tr>
</table>
$message
</center>
";
?>
</BODY>
</HTML>