rendered paste body<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Tiedostolistaus</title></head><body><p><a href="../upload.php">Upload</a></p><form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post"><table width=500 style="font-family:courier new;font-size:12px"><tr bgcolor=#DDDDDD><td><b>tiedostonimi</b></td> <td><b>koko (t)</b></td> <td><b>lisätty</b></td> <td><b>poista</b></td></tr><?phpif (!is_null($_POST['submitDelete'])){ $delList = array(); $fileList = array(); foreach ($_POST as $id => $file) { $op = substr($id, 0, strpos($id, "#")); $n = substr($id, strpos($id, "#") + 1); switch ($op) { case "selected": $delList[$n] = true; break; case "filename": $fileList[$n] = $file; break; } } $theList = array_intersect_key($fileList, $delList); if (count($theList) > 0) { echo "Poistetaan:<br>"; } foreach ($theList as $file) { echo $file . " "; $ok = @unlink($file); echo ($ok ? "ok<br>" : "virhe<br>"); }}$nim = opendir('.');$blacklist = array(".", "..", "index.php"); // listaa tähän tiedostot joita ei näytetä$tied = 0;while ($ltied = readdir($nim)) { if (!in_array($ltied, $blacklist)) { if (is_dir($ltied)) { echo "<tr>"; echo "<td><a href=\"$ltied\">$ltied/</a></td>"; echo "<td>hak</td>"; echo "<td>".date("d.m.y H:i",filectime($ltied))."</td>"; echo "</tr>"; $hak++; } else { echo "<tr>"; echo "<td><a href=\"$ltied\">$ltied</a><br></td>"; echo "<td>".filesize($ltied)."</td>"; echo "<td>".date("d.m.y H:i",filectime($ltied))."</td>"; echo "<td>"; echo "<input type=\"checkbox\" name=\"selected#$tied\">"; echo "<input type=\"hidden\" name=\"filename#$tied\" value=\"$ltied\">"; echo "</td>"; echo "</tr>\n"; $tied++; $tiedk=$tiedk+filesize($ltied); } }}closedir($nim);echo "</table>";echo "<p style=\"font-family:courier new;font-size:12px\">Yhteensä $hak hakemisto(a) ja $tied tiedosto(a), koko $tiedk tavua</p>";?><input type="submit" name="submitDelete" value="Poista valitut" onclick="return confirm('Oletko varma?')"></form></body></html>