Verfasst: 29.05.2003 15:30
So, das sollte funktionieren.
Mfg
Muldini
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management
$page_title = $lang['FileUpload'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// User überprüfen START
if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $userdata['user_level'] == JUNIOR_ADMIN )
{
}
else
{
message_die(GENERAL_MESSAGE, $lang['Not_Authorised'], $lang['Not_Authorised']);
exit;
}
// User überprüfen ENDE
if($_POST[submit_update])
{
foreach($_POST[check] as $file)
{
$base_dir = './upload/';
$path = $base_dir;
unlink($path.$file);
}
}
?>
<table width='100%' border='0' cellpadding='1' cellspacing='1' style='border-collapse: collapse' class='forumline'>
<tr>
<td class='catHead' width='100%' colspan='3' height='25'><span class='cattitle'><center><b>Verzeichnisinhalt von ./upload</b></center></span></td>
</tr>
<tr>
<td colspan='3' height='1' class='row3'><img src='images/spacer.gif' width='1' height='1' alt='.'></td>
</tr>
<tr>
<th align='center' height='25' width='70%' class='toprow' nowrap='nowrap'> Datei </th>
<th align='center' height='25' width='20%' class='toprow' nowrap='nowrap'> Größe </th>
<th align='center' height='25' width='10%' class='toprow' nowrap='nowrap'> Datei löschen </th>
</tr>
<form method="post" name="post" action="fileuploaddel.php">
<?php
// ##### Verzeichnsis lesen - START #####
$base_dir = './upload/';
$path = $base_dir;
$dir_handle = @opendir($path) or die("Das Verzeichnis $path konnte nicht geöffnet werden !");
$space=" ";
if ($path != "."){
while ($file = readdir($dir_handle)) {
if($file=='.'||$file=='..')
continue;
$t="<tr><td align='left' class='row2'> <span class='genmed'><a href=$path$file>$file</a></span> </td>";
echo $t.substr($space,0,40-strlen($file)) ;
$t=(filesize($path.$file)/1024);
$t=sprintf("<td align='center' class='row3'> <span class='genmed'>%01.2f",$t)."kB</span> </td>
<td align='center' class='row3'> <span class='gensmall'><input type='checkbox' name='check[]' value='$file'></span> </td>";
echo substr($space,0,10-strlen($t)) . $t ;
}
} elseif ($path = ".") {
while ($file = readdir($dir_handle)) {
$t="<a href=$file>$file</a>";
echo $t.substr($space,0,40-strlen($file)) ;
$t=(filesize($file)/1024);
$t=sprintf("%01.2f",$t)."kb ";
echo substr($space,0,10-strlen($t)) . $t;
}
}
closedir($dir_handle);
echo "</table>";
// ##### Verzeichnsis lesen - ENDE #####
?>
<script language="Javascript" type="text/javascript">
function select_switch(status)
{
for (i = 0; i < document.file_delete.length; i++)
{
document.file_delete.elements[i].checked = status;
}
}
</script>
<a href="javascript:select_switch(true);" class="gensmall">Alle markieren</a> ::
<a href="javascript:select_switch(false);" class="gensmall">Markierungen aufheben</a>
</span></td></tr><tr><td width="50%" colspan="1" align="center" valign="middle">
<input class="liteoption" type="submit" name="submit_update" value="Ausgewählte Dateien löschen" />
</td></tr></table>
</form>
Muldini