forked from gh0std4ncer/DOXBIN
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharchive.php
executable file
·210 lines (177 loc) · 5.96 KB
/
archive.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?php
header('Content-Disposition: inline; filename="archive.php"');
$dirFiles = array();
if (!isset($_GET['sort'])) {
$_GET['sort'] = "undefine";
}
//load all txt files into an array
if ($handle = opendir('dox')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file !=".." && $file != ".htaccess" && $file != ".txt" && $file != "*.txt") {
$dirFiles[] = $file;
}
}
closedir($handle);
}
//Navigation
echo 'Last <a href="?sort=1" alt="24 hours">24 hours</a> <a href="?sort=2" alt="3 Days" >3 Days</a> <a href="?sort=3" alt="week" >week</a> <a href="?sort=4" alt="month" >month</a><br />';
//search Form NEW
echo '<table border="0" cellspacing="0" cellpadding="3">';
echo '<tr align="left" valign="top">';
echo ' <td>Search:';
echo ' <form action="./search.php" method="GET" target="_self">';
echo ' <input type="hidden" value="SEARCH" name="action">';
echo ' <input type="text" name="keyword" class="text" size="12" maxlength="30" placeholder="Search query" onFocus=" if (value == ';
echo "''";
echo ") {value=''}\" onBlur=\"if (value == '') {value=";
echo "''}\" > ";
echo ' <input type="submit" value="Search" class="button"><br />';
echo ' </form>';
echo ' </td>';
echo '</tr>';
echo '</table>';
echo '<br /><br />';
//get the sort by GET_
// example URL http://www.coolepage.de/site.php?sort=1
//set the Default show Time
if(empty($_GET))
{
$showdays = 9001;
}
else
{
//catch the NULL byter
$get_sort = preg_quote($_GET['sort'],'/');
//regex a whitelist of input
$whitelist_sort = preg_replace('[^0-9]', '', $get_sort);
//only use the first char of the input
//onyl 1 char
$cutinput = substr($whitelist_sort,0,1) ;
//the switcher
switch ((int)$cutinput)
{
case 0:
//default, again. cauz use GET with "id=0" or so. looks very strange
$showdays = 9001;
break;
case 1:
//last week
$showdays = 1;
break;
case 2:
//last month
$showdays = 3;
break;
case 3:
//last 3 days
$showdays = 7;
break;
case 4:
//last 24 hours
$showdays = 30;
break;
//case "5":
//echo "adding soemthing new";
//break;
default:
$showdays = 9001;
}
}
//Sort an array using a case insensitive "natural order" algorithm
//This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations.
//This is described as a "natural ordering".
//(c) php-manual
natcasesort($dirFiles);
//the table header
echo '<table><thead><tr>';
echo '<th class="doxcols">Name</th> <th class="doxcols">Hits</th> <th class="doxcols">Date</th> <th class="doxcols">Time</th> <th class="doxcols">Filesize</th>';
echo '</tr></thead><tbody>';
//the index of the files (yes dirty way ;)
$key= 0;
foreach($dirFiles as $file) {
//counter of the index
$key++;
//$file need an extensions
if( stristr($file,'.txt') )
{
//remove the extensions for cleaner output
$xfile = str_replace(".txt", "", $file);
// echo "<tr>";
// echo "<td>";
if( (time() - filemtime("dox/$file")) <= ( $showdays * 86400 ) )
{
//the Output of the dox
echo '<tr>';
echo '<td>';
echo '<a href="doxviewer.php?dox='.$xfile.'" alt="'.$xfile.'">'.$xfile."</a>";
//Icon Output
if(file_exists('img/verification/'.$file))
{
$datestamp = file_get_contents('img/verification/'.$file);
echo ' <img src="img/green-checkbox.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
if(file_exists('img/ssn/'.$file))
{
$datestamp = file_get_contents('img/ssn/'.$file);
echo ' <img src="img/ssn.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
if(file_exists('img/rip/'.$file))
{
$datestamp = file_get_contents('img/rip/'.$file);
echo ' <img src="img/rip.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
if(file_exists('img/mail/'.$file))
{
$datestamp = file_get_contents('img/mail/'.$file);
echo ' <img src="img/mail.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
if(file_exists('img/isp/'.$file))
{
$datestamp = file_get_contents('img/isp/'.$file);
echo ' <img src="img/isp.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
if(file_exists('img/db/'.$file))
{
$datestamp = file_get_contents('img/db/'.$file);
echo ' <img src="img/db.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
if(file_exists('img/pr/'.$file))
{
$datestamp = file_get_contents('img/pr/'.$file);
echo ' <img src="img/pr.png" alt="'.$datestamp.'" title="'.$datestamp.'" />';
}
echo '</td>';
//the rest of the listing
//the number of hits of the file
echo '<td>';
echo file_get_contents("hits/$file");
echo '</td>';
//the date of the file
echo '<td>';
echo date("m/d/Y", filemtime("dox/$file"));
echo '</td>';
//the time of the file
echo '<td>';
echo date("H:i:s", filemtime("dox/$file"));
echo '</td>';
//the filesize in KB of the file
echo '<td>';
$filesize = filesize("dox/$file");
$file_kb = round(($filesize / 1024), 2);
echo $file_kb.' KB';
echo '</td>';
echo '</tr>';
}
}
else
{
//if the txt-file have not an extensions, it will not show in the output.
//echo "LOLOL n1 try";
}
}
//close the table
echo '</tbody></table>';
?>
<p><a href="#">Back to top...</a></p>
</body>
</html>