Advertisement
pusatdata

Index of File dari Nazuka.net

Dec 3rd, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. <?php
  2. $host=$_SERVER['HTTP_HOST'];
  3. /*
  4. Directory Listing Script - Version 2
  5. ====================================
  6. Script Author: Ash Young <ash@evoluted.net>. www.evoluted.net
  7. Layout: Manny <manny@tenka.co.uk>. www.tenka.co.uk
  8. */
  9. $startdir = '.';
  10. $showthumbnails = false;
  11. $showdirs = true;
  12. $forcedownloads = false;
  13. $hide = array(
  14. 'dlf',
  15. 'public_html',
  16. 'index.php',
  17. 'Thumbs',
  18. '.htaccess',
  19. '_file-manager',
  20. '.quarantine',
  21. '.tmb',
  22. '.htpasswd'
  23. );
  24. $displayindex = false;
  25. $allowuploads = false;
  26. $overwrite = false;
  27.  
  28. $indexfiles = array (
  29. 'index.html',
  30. 'index.htm',
  31. 'default.htm',
  32. 'default.html'
  33. );
  34.  
  35. $filetypes = array (
  36. 'png' => 'jpg.gif',
  37. 'jpeg' => 'jpg.gif',
  38. 'bmp' => 'jpg.gif',
  39. 'jpg' => 'jpg.gif',
  40. 'gif' => 'gif.gif',
  41. 'zip' => 'archive.png',
  42. 'rar' => 'archive.png',
  43. 'exe' => 'exe.gif',
  44. 'setup' => 'setup.gif',
  45. 'txt' => 'text.png',
  46. 'htm' => 'html.gif',
  47. 'html' => 'html.gif',
  48. 'php' => 'php.gif',
  49. 'fla' => 'fla.gif',
  50. 'swf' => 'swf.gif',
  51. 'xls' => 'xls.gif',
  52. 'doc' => 'doc.gif',
  53. 'sig' => 'sig.gif',
  54. 'fh10' => 'fh10.gif',
  55. 'pdf' => 'pdf.gif',
  56. 'psd' => 'psd.gif',
  57. 'rm' => 'real.gif',
  58. 'mpg' => 'video.gif',
  59. 'mpeg' => 'video.gif',
  60. 'mov' => 'video2.gif',
  61. 'avi' => 'video.gif',
  62. 'eps' => 'eps.gif',
  63. 'gz' => 'archive.png',
  64. 'asc' => 'sig.gif',
  65. );
  66.  
  67. error_reporting(0);
  68. if(!function_exists('imagecreatetruecolor')) $showthumbnails = false;
  69. $leadon = $startdir;
  70. if($leadon=='.') $leadon = '';
  71. if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/';
  72. $startdir = $leadon;
  73.  
  74. if($_GET['dir']) {
  75. //check this is okay.
  76.  
  77. if(substr($_GET['dir'], -1, 1)!='/') {
  78. $_GET['dir'] = $_GET['dir'] . '/';
  79. }
  80.  
  81. $dirok = true;
  82. $dirnames = split('/', $_GET['dir']);
  83. for($di=0; $di<sizeof($dirnames); $di++) {
  84.  
  85. if($di<(sizeof($dirnames)-2)) {
  86. $dotdotdir = $dotdotdir . $dirnames[$di] . '/';
  87. }
  88.  
  89. if($dirnames[$di] == '..') {
  90. $dirok = false;
  91. }
  92. }
  93.  
  94. if(substr($_GET['dir'], 0, 1)=='/') {
  95. $dirok = false;
  96. }
  97.  
  98. if($dirok) {
  99. $leadon = $leadon . $_GET['dir'];
  100. }
  101. }
  102.  
  103.  
  104.  
  105. $opendir = $leadon;
  106. if(!$leadon) $opendir = '.';
  107. if(!file_exists($opendir)) {
  108. $opendir = '.';
  109. $leadon = $startdir;
  110. }
  111.  
  112. clearstatcache();
  113. if ($handle = opendir($opendir)) {
  114. while (false !== ($file = readdir($handle))) {
  115. //first see if this file is required in the listing
  116. if ($file == "." || $file == "..") continue;
  117. $discard = false;
  118. for($hi=0;$hi<sizeof($hide);$hi++) {
  119. if(strpos($file, $hide[$hi])!==false) {
  120. $discard = true;
  121. }
  122. }
  123.  
  124. if($discard) continue;
  125. if (@filetype($leadon.$file) == "dir") {
  126. if(!$showdirs) continue;
  127.  
  128. $n++;
  129. if($_GET['sort']=="date") {
  130. $key = @filemtime($leadon.$file) . ".$n";
  131. }
  132. else {
  133. $key = $n;
  134. }
  135. $dirs[$key] = $file . "/";
  136. }
  137. else {
  138. $n++;
  139. if($_GET['sort']=="date") {
  140. $key = @filemtime($leadon.$file) . ".$n";
  141. }
  142. elseif($_GET['sort']=="size") {
  143. $key = @filesize($leadon.$file) . ".$n";
  144. }
  145. else {
  146. $key = $n;
  147. }
  148. $files[$key] = $file;
  149.  
  150. if($displayindex) {
  151. if(in_array(strtolower($file), $indexfiles)) {
  152. header("Location: $file");
  153. die();
  154. }
  155. }
  156. }
  157. }
  158. closedir($handle);
  159. }
  160.  
  161. //sort our files
  162. if($_GET['sort']=="date") {
  163. @ksort($dirs, SORT_NUMERIC);
  164. @ksort($files, SORT_NUMERIC);
  165. }
  166. elseif($_GET['sort']=="size") {
  167. @natcasesort($dirs);
  168. @ksort($files, SORT_NUMERIC);
  169. }
  170. else {
  171. @natcasesort($dirs);
  172. @natcasesort($files);
  173. }
  174.  
  175. //order correctly
  176. if($_GET['order']=="desc" && $_GET['sort']!="size") {$dirs = @array_reverse($dirs);}
  177. if($_GET['order']=="desc") {$files = @array_reverse($files);}
  178. $dirs = @array_values($dirs); $files = @array_values($files);
  179.  
  180.  
  181. ?>
  182. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  183. <html xmlns="http://www.w3.org/1999/xhtml">
  184. <head>
  185. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  186. <title>Welcome to <? print $host; ?></title>
  187. <link rel="stylesheet" type="text/css" href="http://cpanel.main-hosting.com/images/index/styles.css" />
  188. </head>
  189. <body>
  190. <div id="container">
  191. <h1>Your website is up and running!</h1>
  192. <div id="breadcrumbs">
  193. <p>Website <strong><? print $host; ?></strong> has been successfully installed on the server.<br />
  194. Please delete the file &quot;<strong>default.php</strong>&quot; from the <strong>public_html</strong> folder and upload your website by using FTP or web based File Manager.</p>
  195. <p>Below you can see your current files in <strong>public_html</strong> folder.</p>
  196. </div>
  197. <div id="listingcontainer">
  198. <div id="listingheader">
  199. <div id="headerfile">File</div>
  200. <div id="headersize">Size</div>
  201. <div id="headermodified">Last Modified</div>
  202. </div>
  203. <div id="listing">
  204. <?
  205. $class = 'b';
  206. if($dirok) {
  207. ?>
  208. <div><a href="<?=$dotdotdir;?>" class="<?=$class;?>"><img src="http://cpanel.main-hosting.com/images/index/dirup.png" alt="Folder" /><strong>..</strong> <em>-</em>
  209. <?=date ("M d Y h:i:s A", filemtime($dotdotdir));?>
  210. </a></div>
  211. <?
  212. if($class=='b') $class='w';
  213. else $class = 'b';
  214. }
  215. $arsize = sizeof($dirs);
  216. for($i=0;$i<$arsize;$i++) {
  217. ?>
  218. <div><a href="<?=$leadon.$dirs[$i];?>" class="<?=$class;?>"><img src="http://cpanel.main-hosting.com/images/index/folder.png" alt="<?=$dirs[$i];?>" /><strong>
  219. <?=$dirs[$i];?>
  220. </strong> <em>-</em>
  221. <?=date ("M d Y h:i:s A", filemtime($leadon.$dirs[$i]));?>
  222. </a></div>
  223. <?
  224. if($class=='b') $class='w';
  225. else $class = 'b';
  226. }
  227.  
  228. $arsize = sizeof($files);
  229. for($i=0;$i<$arsize;$i++) {
  230. $icon = 'unknown.png';
  231. $ext = strtolower(substr($files[$i], strrpos($files[$i], '.')+1));
  232. $supportedimages = array('gif', 'png', 'jpeg', 'jpg');
  233. $thumb = '';
  234.  
  235. if($filetypes[$ext]) {
  236. $icon = $filetypes[$ext];
  237. }
  238.  
  239. $filename = $files[$i];
  240. if(strlen($filename)>43) {
  241. $filename = substr($files[$i], 0, 40) . '...';
  242. }
  243.  
  244. $fileurl = $leadon . $files[$i];
  245. ?>
  246. <div><a href="<?=$fileurl;?>" class="<?=$class;?>"<?=$thumb2;?>><img src="http://cpanel.main-hosting.com/images/index/<?=$icon;?>" alt="<?=$files[$i];?>" /><strong>
  247. <?=$filename;?>
  248. </strong> <em>
  249. <?=round(filesize($leadon.$files[$i])/1024);?>
  250. KB</em>
  251. <?=date ("M d Y h:i:s A", filemtime($leadon.$files[$i]));?>
  252. <?=$thumb;?>
  253. </a></div>
  254. <?
  255. if($class=='b') $class='w';
  256. else $class = 'b';
  257. }
  258. ?>
  259. </div>
  260. </div>
  261. </div>
  262. <div id="copy"><? $c_global_f = get_cfg_var('c_global_f'); if (!empty($c_global_f)) echo $c_global_f; ?></div>
  263. </body>
  264. </html>
  265. <!--DEFAULT_WELCOME_PAGE-->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement