Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1.  
  2. <html>
  3. <title>secret website</title>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  7. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
  8. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  9. <body>
  10. <div class="w3-top">
  11. <div class="w3-bar w3-black w3-card-2">
  12. <a class="w3-bar-item w3-button w3-padding-large w3-hide-medium w3-hide-large w3-right" href="javascript:void(0)" onclick="myFunction()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i></a>
  13. <a href="../" class="w3-bar-item w3-button w3-padding-large">Back</a>
  14. </div>
  15. </div>
  16.  
  17. <style type="text/css">
  18. tr{
  19. border: 1px solid #808080;
  20. background: #999999;
  21. padding: 5px;
  22. }
  23. </style>
  24. <center>
  25.  
  26. <?php
  27.  
  28.  
  29. $valid_passwords = array ("user" => "pw");
  30. $valid_users = array_keys($valid_passwords);
  31.  
  32. $user;
  33. $pass;
  34.  
  35. if(!isset($_SERVER['PHP_AUTH_PW'] || !isset($_SERVER['PHP_AUTH_PW'])){
  36. header('WWW-Authenticate: Basic realm="Login Page"');
  37. header('HTTP/1.0 401 Unauthorized');
  38. echo ("You are not allowed to download here!");
  39. echo (" and ");
  40. die ("Thanks for you IP! [$ip]");
  41. }else{
  42. $pass = $_SERVER['PHP_AUTH_PW'];
  43. $user = $_SERVER['PHP_AUTH_USER'];
  44. }
  45.  
  46. $ip = $_SERVER['REMOTE_ADDR'];
  47.  
  48. $validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
  49.  
  50. if( isset( $_GET['']))
  51. $pass = $_GET[''];
  52.  
  53. if (!$validated) {
  54. header('WWW-Authenticate: Basic realm="Login Page"');
  55. header('HTTP/1.0 401 Unauthorized');
  56. echo ("You are not allowed to download here!");
  57. echo (" and ");
  58. die ("Thanks for you IP! [$ip]");
  59. }
  60.  
  61. // If arrives here, is a valid user.
  62. echo "<p>why you do dis? ;_;<p>";
  63. echo "<p>Welcome $user.</p>";
  64. echo "<p>Download my shitty work here</p>";
  65.  
  66. # The current directory
  67. $directory = dir("./");
  68.  
  69. # If you want to turn on Extension Filter, then uncomment this:
  70. ### $allowed_ext = array(".sample", ".png", ".jpg", ".jpeg", ".txt", ".doc", ".xls");
  71.  
  72.  
  73.  
  74.  
  75. ## Description of the soft: list_dir_files.php
  76. ## Major credits: phpDIRList 2.0 -(c)2005 Ulrich S. Kapp :: Systemberatung ::
  77.  
  78. $do_link = TRUE;
  79. $sort_what = 0; //0- by name; 1 - by size; 2 - by date
  80. $sort_how = 0; //0 - ASCENDING; 1 - DESCENDING
  81.  
  82.  
  83. # # #
  84. function dir_list($dir){
  85. $i=0;
  86. $dl = array();
  87. if ($hd = opendir($dir)) {
  88. while ($sz = readdir($hd)) {
  89. if (preg_match("/^\./",$sz)==0) $dl[] = $sz;$i.=1;
  90. }
  91. closedir($hd);
  92. }
  93. asort($dl);
  94. return $dl;
  95. }
  96. if ($sort_how == 0) {
  97. function compare0($x, $y) {
  98. if ( $x[0] == $y[0] ) return 0;
  99. else if ( $x[0] < $y[0] ) return -1;
  100. else return 1;
  101. }
  102. function compare1($x, $y) {
  103. if ( $x[1] == $y[1] ) return 0;
  104. else if ( $x[1] < $y[1] ) return -1;
  105. else return 1;
  106. }
  107. function compare2($x, $y) {
  108. if ( $x[2] == $y[2] ) return 0;
  109. else if ( $x[2] < $y[2] ) return -1;
  110. else return 1;
  111. }
  112. }else{
  113. function compare0($x, $y) {
  114. if ( $x[0] == $y[0] ) return 0;
  115. else if ( $x[0] < $y[0] ) return 1;
  116. else return -1;
  117. }
  118. function compare1($x, $y) {
  119. if ( $x[1] == $y[1] ) return 0;
  120. else if ( $x[1] < $y[1] ) return 1;
  121. else return -1;
  122. }
  123. function compare2($x, $y) {
  124. if ( $x[2] == $y[2] ) return 0;
  125. else if ( $x[2] < $y[2] ) return 1;
  126. else return -1;
  127. }
  128.  
  129. }
  130.  
  131. ##################################################
  132. # We get the information here
  133. ##################################################
  134.  
  135. $i = 0;
  136. while($file=$directory->read()) {
  137. $file = strtolower($file);
  138. $ext = strrchr($file, '.');
  139. if (isset($allowed_ext) && (!in_array($ext,$allowed_ext)))
  140. {
  141. // dump
  142. }
  143. else {
  144. $temp_info = stat($file);
  145. $new_array[$i][0] = $file;
  146. $new_array[$i][1] = $temp_info[7];
  147. $new_array[$i][2] = $temp_info[9];
  148. $new_array[$i][3] = date("F d, Y", $new_array[$i][2]);
  149. $i = $i + 1;
  150. }
  151. }
  152. $directory->close();
  153.  
  154. ##################################################
  155. # We sort the information here
  156. #################################################
  157.  
  158. switch ($sort_what) {
  159. case 0:
  160. usort($new_array, "compare0");
  161. break;
  162. case 1:
  163. usort($new_array, "compare1");
  164. break;
  165. case 2:
  166. usort($new_array, "compare2");
  167. break;
  168. }
  169.  
  170. ###############################################################
  171. # We display the infomation here
  172. ###############################################################
  173.  
  174. $i2 = count($new_array);
  175. $i = 0;
  176. echo "<table border=1>
  177. <tr>
  178. <td width=150> Name </td>
  179. <td width=100> File Size</td>
  180. <td width=100>Last Modified</td>
  181. </tr>";
  182. for ($i=0;$i<$i2;$i++) {
  183. if (!$do_link) {
  184. $line = "<tr><td align=right>" .
  185. $new_array[$i][0] .
  186. "</td><td align=right>" .
  187. number_format(($new_array[$i][1]/1024)) .
  188. "k";
  189. $line = $line . "</td><td align=right>" . $new_array[$i][3] . "</td></tr>";
  190. }else{
  191. $line = '<tr><td align=right><A HREF="' .
  192. $new_array[$i][0] . '">' .
  193. $new_array[$i][0] .
  194. "</A></td><td align=right>";
  195. $line = $line . number_format(($new_array[$i][1]/1024)) .
  196. "k" . "</td><td align=right>" .
  197. $new_array[$i][3] . "</td></tr>";
  198. }
  199. echo $line;
  200. }
  201. echo "</table>";
  202.  
  203. ?>
  204. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement