<?php
session_start();
echo <<< END
<html>
<head>
<title>Select Files</title>
<style type="text/css">
<!--
body, td { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: x-small; color: Black; }
button { background-color: #EEEEEE; border: 1px ridge Gray; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: xx-small; font-weight: bold; }
input { background-color: #EEEEEE; border: 1px solid Black; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: xx-small; font-weight: bold; }
-->
</style>
</head>
<body>
END;
if(!isset($isokay)) {
echo "<table cellspacing=0 cellpadding=0 width=\"100%\" height=\"100%\">";
echo "<tr><td align=\"center\" valign=\"center\">";
echo "<h3>Error</h3>";
echo "<table width=400>";
echo "<tr><td>You must log in first.</td></tr>";
echo "<tr><td><div align=\"right\"><input type=\"button\" value=\"Log In »\" onClick=\"window.location='index.php'\"></div></td></tr>";
echo "</table>";
echo "</td></tr>";
echo "</table>";
}
else {
$dir = opendir(".") or die("Cannot open directory.");
echo "<form action=\"del.php\" method=\"post\">";
echo "<center>";
echo "<table width=\"90%\" cellspacing=\"1\" cellpadding=\"4\">";
echo "<tr>";
echo "<td bgcolor=\"#8F9AB7\" width=\"20\"> </td>";
echo "<td bgcolor=\"#8F9AB7\"><b>File name</b></td>";
echo "<td bgcolor=\"#8F9Ab7\" width=\"100\"><b>File Size (b)</b></td>";
echo "<td width=\"130\" bgcolor=\"#8F9AB7\"><b>Last Accessed</b></td>";
echo "<td width=\"130\" bgcolor=\"#8F9AB7\"><b>Last Modified</b></td>";
echo "</tr>";
$counter = 1;
while($file = readdir($dir)) {
if($file != "." && $file != ".." && $file != "index.php" && $file != "main.php" && $file != "del.php" && is_file($file)) {
if($counter == 1) {
echo "<tr>";
echo "<td bgcolor=\"#DCE2F2\"><center><input type=\"checkbox\" name=\"delit[]\" value=\"$file\"><center></td>";
echo "<td bgcolor=\"#DCE2F2\">$file</td>";
echo "<td bgcolor=\"#DCE2F2\">".filesize($file)."</td>";
echo "<td bgcolor=\"#DCE2F2\">".date("M j y, H:i", fileatime($file))."</td>";
echo "<td bgcolor=\"#DCE2F2\">".date("M j y, H:i", filectime($file))."</td>";
echo "</tr>";
$counter++;
}
else {
echo "<tr>";
echo "<td bgcolor=\"#CFD5E5\"><center><input type=\"checkbox\" name=\"delit[]\" value=\"$file\"><center></td>";
echo "<td bgcolor=\"#CFD5E5\">$file</td>";
echo "<td bgcolor=\"#CFD5E5\">".filesize($file)."</td>";
echo "<td bgcolor=\"#CFD5E5\">".date("M j y, H:i", fileatime($file))."</td>";
echo "<td bgcolor=\"#CFD5E5\">".date("M j y, H:i", filectime($file))."</td>";
echo "</tr>";
$counter = 1;
}
}
}
echo "<tr><td colspan=\"5\" bgcolor=\"#8F9AB7\"><div align=\"right\"><input type=\"submit\" value=\"Delete Selected\"></div></td></tr";
echo "</table>";
echo "</center>";
echo "</form>";
}
echo <<< END
</body>
</html>
END;
?>