HC.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <?php
  2. /**
  3. * Copyright (c) 2016, 2024, 5 Mode's contributors
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * * Neither 5 Mode nor the names of its contributors
  14. * may be used to endorse or promote products derived from this software
  15. * without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
  21. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. *
  28. * HC.php
  29. *
  30. * Http Console home page.
  31. *
  32. * @author Daniele Bonini <my25mb@aol.com>
  33. * @copyrights (c) 2016, 2024, 5 Mode
  34. * @license https://opensource.org/licenses/BSD-3-Clause
  35. */
  36. require "HC_init.inc";
  37. $cmdHistory = [];
  38. $cmd = HC_STR;
  39. $opt = HC_STR;
  40. $param1 = HC_STR;
  41. $param2 = HC_STR;
  42. $param3 = HC_STR;
  43. $cmdRecallHistory = [];
  44. function showHistory() {
  45. global $cmdHistory;
  46. $i = 1;
  47. foreach($cmdHistory as $val) {
  48. echo(str_replace("\n", "<br>", $val));
  49. $i++;
  50. }
  51. }
  52. function updateHistory(&$update, $maxItems) {
  53. global $cmdHistory;
  54. // Making enough space in $cmdHistory for the update..
  55. $shift = (count($cmdHistory) + count($update)) - $maxItems;
  56. if ($shift > 0) {
  57. $cmdHistory = array_slice($cmdHistory, $shift, $maxItems);
  58. }
  59. // Adding $cmdHistory update..
  60. if (count($update) > $maxItems) {
  61. $beginUpd = count($update) - ($maxItems-1);
  62. } else {
  63. $beginUpd = 0;
  64. }
  65. $update = array_slice($update, $beginUpd, $maxItems);
  66. foreach($update as $val) {
  67. $cmdHistory[] = $val;
  68. }
  69. // Writing out $cmdHistory on disk..
  70. $filepath = HC_APP_PATH . HC_SLASH . ".HC_history";
  71. file_put_contents($filepath, implode('', $cmdHistory));
  72. }
  73. function loadRecallHistory() {
  74. global $cmdRecallHistory;
  75. $tmpcmdRecallHistory = file(HC_APP_PATH . HC_SLASH . ".HC_Recallhistory");
  76. foreach($tmpcmdRecallHistory as $val) {
  77. $cmdRecallHistory[left($val, strlen($val)-1)]=$val;
  78. }
  79. }
  80. function updateRecallHistory($update, $maxItems) {
  81. global $cmdRecallHistory;
  82. if (!array_key_exists($update, $cmdRecallHistory)) {
  83. // Making enough space in $cmdHistory for the update..
  84. $shift = (count($cmdRecallHistory) + 1) - $maxItems;
  85. if ($shift > 0) {
  86. $cmdRecallHistory = array_slice($cmdRecallHistory, $shift, $maxItems);
  87. }
  88. $cmdRecallHistory[$update] = $update . "\n";
  89. }
  90. // Writing out $cmdRecallHistory on disk..
  91. $filepath = HC_APP_PATH . HC_SLASH . ".HC_Recallhistory";
  92. file_put_contents($filepath, implode('', $cmdRecallHistory));
  93. }
  94. function updateHistoryWithErr(string $err) {
  95. global $prompt;
  96. global $command;
  97. $output = [];
  98. $output[] = $prompt . " " . $command . "\n";
  99. $output[] = "$err\n";
  100. updateHistory($output, HC_HISTORY_MAX_ITEMS);
  101. }
  102. function myExecCommand() {
  103. global $prompt;
  104. global $command;
  105. // Exec command..
  106. $output = [];
  107. $output[] = $prompt . " " . $command . "\n";
  108. exec($command, $output);
  109. // Update history..
  110. foreach ($output as &$val) {
  111. if (right($val,1)!="\n") {
  112. $val = $val . "\n";
  113. }
  114. }
  115. updateRecallHistory($command, HC_RECALL_HISTORY_MAX_ITEMS);
  116. updateHistory($output, HC_HISTORY_MAX_ITEMS);
  117. }
  118. function myExecCopy() {
  119. global $prompt;
  120. global $command;
  121. global $param1;
  122. global $param2;
  123. // Exec command..
  124. $output = [];
  125. $output[] = $prompt . " " . $command . "\n";
  126. copy($param1, $param2);
  127. // Update history..
  128. foreach ($output as &$val) {
  129. if (right($val,1)!="\n") {
  130. $val = $val . "\n";
  131. }
  132. }
  133. updateRecallHistory($command, HC_RECALL_HISTORY_MAX_ITEMS);
  134. updateHistory($output, HC_HISTORY_MAX_ITEMS);
  135. }
  136. function myExecCDFolderCommand() {
  137. global $prompt;
  138. global $command;
  139. global $param1;
  140. global $curPath;
  141. // Exec command..
  142. $output = [];
  143. $output[] = $prompt . " " . $command . "\n";
  144. //exec($command, $output);
  145. $newPath = $curPath . HC_SLASH . $param1;
  146. chdir($newPath);
  147. $curPath = $newPath;
  148. $curDir = $param1;
  149. // Creating the Download folder if doesn't exist..
  150. $downloadPath = $curPath . HC_SLASH . ".HCdownloads";
  151. if (!file_exists($downloadPath)) {
  152. //copy(HC_APP_STAGE_PATH . HC_SLASH . ".HCsampledir", $downloadPath);
  153. $mycmd = "cp -Rp " . HC_APP_STAGE_PATH . HC_SLASH . ".HCsampledir" . " " . $downloadPath;
  154. $myret = exec($mycmd);
  155. }
  156. $prompt = str_replace("$1", $curDir, HC_APP_PROMPT);
  157. // Update history..
  158. foreach ($output as &$val) {
  159. if (right($val,1)!="\n") {
  160. $val = $val . "\n";
  161. }
  162. }
  163. updateRecallHistory($command, HC_RECALL_HISTORY_MAX_ITEMS);
  164. updateHistory($output, HC_HISTORY_MAX_ITEMS);
  165. }
  166. function myExecCDBackwCommand() {
  167. global $prompt;
  168. global $command;
  169. global $curPath;
  170. // Exec command..
  171. $output = [];
  172. $output[] = $prompt . " " . $command . "\n";
  173. //exec($command, $output);
  174. $ipos = strripos($curPath, HC_SLASH);
  175. $newPath = substr($curPath, 0, $ipos);
  176. chdir($newPath);
  177. $curPath = getcwd();
  178. $ipos = strripos($curPath, HC_SLASH);
  179. $curDir = substr($curPath, $ipos);
  180. $prompt = str_replace("$1", $curDir, HC_APP_PROMPT);
  181. // Update history..
  182. foreach ($output as &$val) {
  183. if (right($val,1)!="\n") {
  184. $val = $val . "\n";
  185. }
  186. }
  187. updateRecallHistory($command, HC_RECALL_HISTORY_MAX_ITEMS);
  188. updateHistory($output, HC_HISTORY_MAX_ITEMS);
  189. }
  190. function myExecLSCommand() {
  191. global $prompt;
  192. global $command;
  193. global $curPath;
  194. $downloadPath = $curPath . HC_SLASH . ".HCdownloads";
  195. // Exec command..
  196. $output = [];
  197. $output[] = $prompt . " " . $command . "\n";
  198. exec($command, $output);
  199. // Creating the Download path for the current folder..
  200. if (!file_exists($downloadPath)) {
  201. //copy(HC_APP_STAGE_PATH . HC_SLASH . ".HCsampledir", $downloadPath);
  202. $mycmd = "cp -Rp " . HC_APP_STAGE_PATH . HC_SLASH . ".HCsampledir" . " " . $downloadPath;
  203. $myret=exec($mycmd);
  204. }
  205. // Cleaning the Download folder..
  206. if (file_exists($downloadPath)) {
  207. $files1 = scandir($downloadPath);
  208. foreach($files1 as $file) {
  209. if (!is_dir($downloadPath . HC_SLASH . $file) && $file !== "." && $file !== "..") {
  210. unlink($downloadPath . HC_SLASH . $file);
  211. }
  212. }
  213. }
  214. // Update history..
  215. foreach ($output as &$val) {
  216. if ($val === $prompt . " " . $command . "\n") {
  217. } else {
  218. if (right($val,1)==="\n") {
  219. $val = left($val, strlen($val)-1);
  220. }
  221. // Creating the tmp download for the file entry and generating the virtual path..
  222. $virtualPath = HC_STR;
  223. if (file_exists($downloadPath)) {
  224. if (!is_dir($curPath . HC_SLASH . $val) && filesize($curPath . HC_SLASH . $val)<=651000) {
  225. copy($curPath . HC_SLASH . $val, $downloadPath . HC_SLASH . $val . ".hcd");
  226. $virtualPath = getVirtualPath($downloadPath . HC_SLASH . $val . ".hcd");
  227. }
  228. } else {
  229. $virtualPath=HC_STR;
  230. }
  231. if ($virtualPath!==HC_STR) {
  232. $val = "<a href='$virtualPath'>" . $val . "</a>\n";
  233. } else {
  234. $val = $val . "\n";
  235. }
  236. }
  237. }
  238. updateRecallHistory($command, HC_RECALL_HISTORY_MAX_ITEMS);
  239. updateHistory($output, HC_HISTORY_MAX_ITEMS);
  240. }
  241. function parseCommand() {
  242. global $command;
  243. global $cmd;
  244. global $opt;
  245. global $param1;
  246. global $param2;
  247. global $param3;
  248. $str = trim($command);
  249. $ipos = stripos($str, HC_SPACE);
  250. if ($ipos > 0) {
  251. $cmd = left($str, $ipos);
  252. $str = substr($str, $ipos+1);
  253. } else {
  254. $cmd = $str;
  255. return;
  256. }
  257. if (left($str, 1) === "-") {
  258. $ipos = stripos($str, HC_SPACE);
  259. if ($ipos > 0) {
  260. $opt = left($str, $ipos);
  261. $str = substr($str, $ipos+1);
  262. } else {
  263. $opt = $str;
  264. return;
  265. }
  266. }
  267. $ipos = stripos($str, HC_SPACE);
  268. if ($ipos > 0) {
  269. $param1 = left($str, $ipos);
  270. $str = substr($str, $ipos+1);
  271. } else {
  272. $param1 = $str;
  273. return;
  274. }
  275. $ipos = stripos($str, HC_SPACE);
  276. if ($ipos > 0) {
  277. $param2 = left($str, $ipos);
  278. $str = substr($str, $ipos+1);
  279. } else {
  280. $param2 = $str;
  281. return;
  282. }
  283. $ipos = stripos($str, HC_SPACE);
  284. if ($ipos > 0) {
  285. $param3 = left($str, $ipos);
  286. $str = substr($str, $ipos+1);
  287. } else {
  288. $param3 = $str;
  289. return;
  290. }
  291. }
  292. function is_word(string $string) {
  293. return preg_match("/^[\w\-]+?$/", $string);
  294. }
  295. function cdparamValidation() {
  296. global $curPath;
  297. global $param1;
  298. global $param2;
  299. //param1!="" and isword
  300. if (($param1===HC_STR) && !is_word($param1)) {
  301. updateHistoryWithErr("invalid dir");
  302. return false;
  303. }
  304. //param2==""
  305. if ($param2!==HC_STR) {
  306. updateHistoryWithErr("invalid parameters");
  307. return false;
  308. }
  309. //param1 exist and is_dir
  310. $path = $curPath . HC_SLASH . $param1;
  311. if (!file_exists($path) || !is_dir($path)) {
  312. updateHistoryWithErr("dir doesn't exist");
  313. return false;
  314. }
  315. return true;
  316. }
  317. function cpparamValidation() {
  318. global $curPath;
  319. global $opt;
  320. global $param1;
  321. global $param2;
  322. global $param3;
  323. //opt!="" and opt!="-R" and opt!="-Rp"
  324. if (($opt!==HC_STR) && ($opt!=="-R") && ($opt!=="-Rp") && ($opt!=="-p")) {
  325. updateHistoryWithErr("invalid parameters");
  326. return false;
  327. }
  328. //param1!="" and isword
  329. if (($param1===HC_STR) && !is_word($param1)) {
  330. updateHistoryWithErr("invalid source path");
  331. return false;
  332. }
  333. //param2!="" and isword
  334. if (($param2===HC_STR) && !is_word($param2)) {
  335. updateHistoryWithErr("invalid destination path");
  336. return false;
  337. }
  338. if ($param3!=HC_STR) {
  339. updateHistoryWithErr("invalid parameters");
  340. return false;
  341. }
  342. //param1 exist
  343. $path = $curPath . HC_SLASH . $param1;
  344. if (!file_exists($path)) {
  345. updateHistoryWithErr("source must exists");
  346. return false;
  347. }
  348. //param2 doesn't exist
  349. $path = $curPath . HC_SLASH . $param2;
  350. if (file_exists($path)) {
  351. updateHistoryWithErr("destination already exists");
  352. return false;
  353. }
  354. return true;
  355. }
  356. function mvparamValidation() {
  357. global $curPath;
  358. global $opt;
  359. global $param1;
  360. global $param2;
  361. global $param3;
  362. //opt!="" and opt!="-R"
  363. if ($opt!==HC_STR) {
  364. updateHistoryWithErr("invalid parameters");
  365. return false;
  366. }
  367. //param1!="" and isword
  368. if (($param1===HC_STR) && !is_word($param1)) {
  369. updateHistoryWithErr("invalid source path");
  370. return false;
  371. }
  372. //param2!="" and isword
  373. if (($param2===HC_STR) && !is_word($param2)) {
  374. updateHistoryWithErr("invalid destination path");
  375. return false;
  376. }
  377. if ($param3!=HC_STR) {
  378. updateHistoryWithErr("invalid parameters");
  379. return false;
  380. }
  381. //param1 exist
  382. $path = $curPath . HC_SLASH . $param1;
  383. if (!file_exists($path)) {
  384. updateHistoryWithErr("source must exists");
  385. return false;
  386. }
  387. //param2 doesn't exist
  388. $path = $curPath . HC_SLASH . $param2;
  389. if (file_exists($path)) {
  390. updateHistoryWithErr("destination already exists");
  391. return false;
  392. }
  393. return true;
  394. }
  395. $password = filter_input(INPUT_POST, "Password");
  396. $command = filter_input(INPUT_POST, "CommandLine");
  397. $pwd = filter_input(INPUT_POST, "pwd");
  398. $hideFB = filter_input(INPUT_POST, "hideFB");
  399. if ($password !== HC_STR) {
  400. $hash = hash("sha256", $password . HC_APP_SALT, false);
  401. if ($hash !== HC_APP_HASH) {
  402. $password=HC_STR;
  403. }
  404. }
  405. $curPath = HC_APP_STAGE_PATH;
  406. if ($pwd!==HC_STR) {
  407. if (left($pwd, strlen(HC_APP_STAGE_PATH)) === HC_APP_STAGE_PATH) {
  408. $curPath = $pwd;
  409. chdir($curPath);
  410. }
  411. }
  412. $ipos = strripos($curPath, HC_SLASH);
  413. $curDir = substr($curPath, $ipos);
  414. $prompt = str_replace("$1", $curDir, HC_APP_PROMPT);
  415. if ($password !== HC_STR) {
  416. loadRecallHistory();
  417. $cmdHistory = file(HC_APP_PATH . HC_SLASH . ".HC_history");
  418. parseCommand($command);
  419. //echo("cmd=" . $cmd . "<br>");
  420. //echo("opt=" . $opt . "<br>");
  421. //echo("param1=" . $param1 . "<br>");
  422. //echo("param2=" . $param2 . "<br>");
  423. if (mb_stripos(HC_CMDLINE_VALIDCMDS, "|" . $command . "|")) {
  424. if ($command === "cd ..") {
  425. $ipos = strripos($curPath, HC_SLASH);
  426. $nextPath = substr($curPath, 0, $ipos);
  427. if (strlen(HC_APP_STAGE_PATH) > strlen($nextPath)) {
  428. updateHistoryWithErr("out of root boundary");
  429. } else {
  430. myExecCDBackwCommand();
  431. }
  432. } else if ($command === "ls") {
  433. myExecLSCommand();
  434. } else {
  435. myExecCommand();
  436. }
  437. } else if (mb_stripos(HC_CMDLINE_VALIDCMDS, "|" . $cmd . "|")) {
  438. if ($cmd === "cd") {
  439. if (cdparamValidation()) {
  440. myExecCDFolderCommand();
  441. }
  442. } else if ($cmd === "cp") {
  443. if (cpparamValidation()) {
  444. myExecCommand();
  445. }
  446. } else if ($cmd === "mv") {
  447. if (mvparamValidation()) {
  448. myExecCommand();
  449. }
  450. }
  451. } else {
  452. updateHistoryWithErr("invalid command");
  453. }
  454. } else {
  455. $cmdHistory = [];
  456. }
  457. ?>
  458. <!DOCTYPE html>
  459. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  460. <head>
  461. <meta charset="UTF-8"/>
  462. <meta name="style" content="day1"/>
  463. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  464. <!--
  465. Copyright (c) 2016, 2024, 5 Mode
  466. All rights reserved.
  467. Redistribution and use in source and binary forms, with or without
  468. modification, are permitted provided that the following conditions are met:
  469. * Redistributions of source code must retain the above copyright
  470. notice, this list of conditions and the following disclaimer.
  471. * Redistributions in binary form must reproduce the above copyright
  472. notice, this list of conditions and the following disclaimer in the
  473. documentation and/or other materials provided with the distribution.
  474. * Neither 5 Mode nor the names of its contributors
  475. may be used to endorse or promote products derived from this software
  476. without specific prior written permission.
  477. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  478. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  479. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  480. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
  481. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  482. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  483. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  484. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  485. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  486. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  487. https://opensource.org/licenses/BSD-3-Clause -->
  488. <title>Http Console: Ubiquity c'est la vie..</title>
  489. <link rel="shortcut icon" href="./HCres/favicon55.ico?v=<?php echo(time()); ?>" />
  490. <meta name="description" content="Welcome to <?php echo(HC_APP_NAME); ?>"/>
  491. <meta name="author" content="5 Mode"/>
  492. <meta name="robots" content="noindex"/>
  493. <script src="./HCjs/jquery-3.1.0.min.js" type="text/javascript"></script>
  494. <script src="./HCjs/jquery-ui.1.12.1.min.js" type="text/javascript"></script>
  495. <script src="./HCjs/HC_common.js" type="text/javascript"></script>
  496. <script src="./HCjs/bootstrap.min.js" type="text/javascript"></script>
  497. <script src="./HCjs/sha.js" type="text/javascript"></script>
  498. <script src="./HCjs/HC.js" type="text/javascript" defer></script>
  499. <link href="./HCcss/bootstrap.min.css" type="text/css" rel="stylesheet">
  500. <link href="./HCcss/jquery-ui.1.12.1.css" type="text/css" rel="stylesheet">
  501. <link href="./HCcss/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  502. <script>
  503. $(document).ready(function() {
  504. $("#CommandLine").on("keydown",function(e){
  505. key = e.which;
  506. //alert(key);
  507. if (key===13) {
  508. e.preventDefault();
  509. frmHC.submit();
  510. } else {
  511. //e.preventDefault();
  512. }
  513. });
  514. });
  515. window.addEventListener("load", function() {
  516. maxY = document.getElementById("Console").scrollHeight;
  517. //alert(maxY);
  518. document.getElementById("Console").scrollTo(0, maxY);
  519. }, true);
  520. </script>
  521. </head>
  522. <body>
  523. <form id="frmHC" method="POST" action="/hc" target="_self">
  524. <div class="header">
  525. <a href="/" style="color:white; text-decoration: none;"><img src="HCres/hclogo.png" style="width:48px;">&nbsp;Http Console</a>
  526. </div>
  527. <div style="clear:both; float:left; padding:8px; width:15%; height:100%; text-align:center;">
  528. <div style="padding-left:12px;text-align: left;">
  529. &nbsp;Upload
  530. </div>
  531. <br><br><br><br><br><br><br>
  532. <!-- &nbsp;Password<br>
  533. &nbsp;<input type="text" id="Password" name="Password" style="font-size:10px; color:black; width: 90%; border-radius:3px;" value="<?php echo($password);?>"><br>
  534. &nbsp;Salt<br>
  535. &nbsp;<input type="text" id="Salt" style="font-size:10px; color:black; width: 90%; border-radius:3px;" autocomplete="off"><br><br>
  536. &nbsp;<input type="button" id="Encode" value="Hash Me!" onclick="showEncodedPassword();" style="position:relative;left:-2px; width:92%; color:black; border-radius:2px;"> -->
  537. &nbsp;<input type="text" id="Password" name="Password" placeholder="password" style="font-size:10px; background:#393939; color:#ffffff; width: 90%; border-radius:3px;" value="<?php echo($password);?>" autocomplete="off"><br>
  538. &nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:10px; background:#393939; color:#ffffff; width: 90%; border-radius:3px;" autocomplete="off"><br>
  539. &nbsp;<a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; color:#ffffff; font-size:12px;">Hash Me!</a>
  540. </div>
  541. <div style="float:left; width:85%;height:100%; padding:8px; border-left: 1px solid #2c2f34;">
  542. <?php if ($hideFB !== HC_STR): ?>
  543. <div id="FirstBanner" style="border-radius:20px; position:relative; left:+3px; width:98%; background-color: #33aced; padding: 20px; margin-bottom:8px;">
  544. <button type="button" class="close" aria-label="Close" onclick="closeFirstBanner();" style="position:relative; left:-10px;">
  545. <span aria-hidden="true">&times;</span>
  546. </button>
  547. Hello and welcome to Http Console!<br><br>
  548. Http Console is a light and simple web console to manage your website.<br><br>
  549. Http Console is supplied AS-IS and we do not take any responsibility for its misusage.<br><br>
  550. First step, use the left side panel password and salt fields to create the hash to insert in the config file. Remember to manually set there also the salt value.<br><br>
  551. As you are going to make work Http Console in the PHP process environment, using a limited web server or phpfpm user, you must follow some simple directives for an optimal first setup:<br>
  552. <ol>
  553. <li>Create a "stage" folder in your web app path; give to the stage folder the write permissions; and set the stage path in the config file.</li>
  554. <li>Inside the stage path create a ".HCsampledir" folder and give to this folder the write permission. This folder will be the sample folder to copy from to create new folders with write permissions inside the stage path.</li>
  555. <li>Likewise create an "upload" folder inside the stage path giving the right permissions.</li>
  556. <li>Configure the max history items and max recall history items as required (default: 50).</li>
  557. </ol>
  558. <br>
  559. Http Console understands a limited set of commands with a far limited set of parameters:<br>
  560. cd, cd.., cp, cp -R, ls, ls -lsa, mv, pwd<br><br>
  561. Hope you can enjoy it and let us know about any feedback: <a href="mailto:info@httpconsole.com" style="color:#e6d236;">info@httpconsole.com</a>
  562. </div>
  563. <?php endif; ?>
  564. &nbsp;Console<br>
  565. <div id="Console" style="height:493px; overflow-y:auto; margin-top:10px;">
  566. <pre style="margin-left:5px;padding-left:0px;border:0px;background-color: #000000; color: #ffffff;">
  567. <?php showHistory($cmdHistory); ?>
  568. <div style="position:relative;top:-15px;"><label id="Prompt" for="CommandLine"><?php echo($prompt); ?></label>&nbsp;<input id="CommandLine" name="CommandLine" list="CommandList" type="text" autocomplete="off" style="width:80%; height:22px; background-color: black; color:white; border:0px; border-bottom: 1px dashed #EEEEEE;"></div>
  569. </pre>
  570. </div>
  571. <datalist id="CommandList">
  572. <?php foreach($cmdRecallHistory as &$val): ?>
  573. <?php $val = left($val, strlen($val)-1); ?>
  574. <?php echo("<option value='$val'>\n"); ?>
  575. <?php endforeach; ?>
  576. </datalist>
  577. </div>
  578. <div class="footer">
  579. <div id="footerCont">&nbsp;</div>
  580. <div id="footer"><span style="background:#FFFFFF;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com">5 Mode</a> project and <a href="http://wysiwyg.systems">WYSIWYG</a> system. Some rights reserved.</span></div>
  581. </div>
  582. <input type="hidden" name="pwd" value="<?php echo($curPath); ?>" style="color:black">
  583. <input type="hidden" name="hideFB" value="<?php echo($hideFB); ?>">
  584. </form>
  585. </body>
  586. </html>