-
Notifications
You must be signed in to change notification settings - Fork 1
/
FileLibrary.php
executable file
·78 lines (73 loc) · 2.06 KB
/
FileLibrary.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/*
Copyright © 2009,2015,2022 Siggi Bjarnason.
Licensed under GNU GPL v3 and later. Check out LICENSE.TXT for details
or see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>
Display content of upload directory with option to delete one, many or all
*/
require("header.php");
$DocRoot = $ConfArray["AdminUploadDir"];
if(isset($_POST["btnSubmit"]))
{
$btnSubmit = $_POST["btnSubmit"];
}
else
{
$btnSubmit = "";
}
if($btnSubmit == "")
{
printPg("Here are the files in the folder $DocRoot","note");
$arrFiles = scandir($DocRoot);
print "<div class=\"CenterBox\">\n";
print "<form method=\"POST\">\n";
$iNum = 1;
foreach($arrFiles as $strFileName)
{
if(substr($strFileName,0,1) != ".")
{
$strBoxName = "File$iNum";
$strLink = "<a href=\"$DocRoot/$strFileName\" target=_blank>$strFileName</a>";
print "<input type=\"checkbox\" name=\"$strBoxName\" value=\"$strFileName\">$strLink<br>\n";
$iNum++;
}
}
printPg("Delete is permanent and there is no undo.<br>\n There is no confirmation either!!!","alert");
print "<div class=\"BlueNote\">\n";
print "<input type=\"submit\" value=\"Delete\" name=\"btnSubmit\">\n";
print "<input type=\"submit\" value=\"Delete ALL\" name=\"btnSubmit\">\n";
print "</div>\n";
print "</form>\n";
print "</div>\n";
}
if($btnSubmit == "Delete")
{
print "<div class=\"CenterBox\">\n";
foreach($_POST as $key => $value)
{
if(substr($key,0,4)=="File")
{
$FileName = "$DocRoot/$value";
print "Deleting $FileName<br>\n";
unlink($FileName);
}
}
print "</div>\n";
}
if($btnSubmit == "Delete ALL")
{
print "<div class=\"CenterBox\">\n";
printPg("Deleting everything","alert");
$arrFiles = scandir($DocRoot);
foreach($arrFiles as $strFileName)
{
if(substr($strFileName,0,1) != ".")
{
unlink("$DocRoot/$strFileName");
}
}
printPg("Done","note");
print "</div>\n";
}
require("footer.php");
?>