-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrandom.php
124 lines (106 loc) · 4.51 KB
/
random.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
<?php
require("configuration.php");
require("file_helpers.php");
require("visuals.php");
/***************************************************************************
* Copyright (C) 2010 by Periklis Ntanasis , Ammar Qammaz *
*
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
function num_files($dir, $recursive=false, $counter=0) {
static $counter;
if(is_dir($dir)) {
if($dh = opendir($dir)) {
while(($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
$counter = (is_dir($dir."/".$file)) ? num_files($dir."/".$file, $recursive, $counter) : $counter+1;
}
}
closedir($dh);
}
}
return $counter;
}
if ( $ENABLE_RANDOM_FILE == 0 )
{
echo "<!DOCTYPE html><html><body>Random File Support is disabled</body></html>";
} else
{
$dir_handle = @opendir("./".$SCRIPT_CACHE_FOLDERNAME."/") or die("Unable to open $path");
$file_to_choose = rand(1,num_files("./".$SCRIPT_CACHE_FOLDERNAME."/",false)-3); // We want a number between 1 and filenum , we have 3 default files in
$counter=0;
$file_served=0;
while ($file = readdir($dir_handle))
{
if ( ( $file == "." )||
( $file == ".." )||
( $file == "index.html" )||
( $file == ".htaccess" )||
( $file == "check_x.png" ) )
{
/* These files are not uploaded from users :P */
} else
{
$counter+=1;
if ( $file_to_choose == $counter )
{
$file_served=1;
$file_parts = pathinfo($file);
//$ext = strtolower($file_parts["extension"]);
$ext="bin";
if (!isset($file_parts["extension"])) { /* EXTENTION REMAINS BIN :P */ } else
{ $ext = strtolower($file_parts["extension"]); }
//TITLE to make search easier!
//$clear_name=$file_parts['filename'];
$filename_parts= explode("-",$file_parts["filename"],2);
$hash_part=$filename_parts[0];
$filename_part=$filename_parts[1];
echo "<!DOCTYPE html>
<html>\n
<head>\n
<title>".$filename_part."</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"myloader.css\" />";
if ( ( $HTML5_COMPATIBILITY_AUDIO_VIDEO == 1 ) && ( (ExtentionIsVideo($ext)==1 && $HTML5_VIDEO==1) || (ExtentionIsAudio($ext)==1 && $HTML5_AUDIO==1) ) )
{ echo "<script src=\"http://html5media.googlecode.com/svn/trunk/src/html5media.min.js\"></script>"; }
if ($HTML5_KEYBOARD == 1 )
{
keyboardjs();
}
echo $HEAD_HTML_INJECTION;
echo " </head>\n
<body>".header_bar()."
<center>";
echo "<br><a href=\"random.php\">See More Random Files!</a> / ";
echo "<a href=\"index.php\">Return to MyLoader!</a><br><br>";
$web_file_server=$SCRIPT_WEB_BASE."file.php?i=".urlencode($file);
PrintFileInBox( $web_file_server,$file,$ext);
echo "<br><br><br><br><a href=\"index.php\">Return to MyLoader!</a>";
echo " </center>";
echo "</body>
</html>";
break;
}
}
}
}
if ( $file_served == 0 )
{
echo "<h2>No File found!</h2>";
echo "<a href=\"random.php\">See More Random Files!</a><br><br>";
echo "<a href=\"index.php\">Return to MyLoader!</a><br><br>";
}
?>