This repository was archived by the owner on Dec 14, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 88 'll ' => 'ls -lvhF ' ,
99);
1010
11- // If we have a current working dir in session, change to that dir
12- if (true === isset ($ _SESSION ['cwd ' ])) {
13- chdir ( $ _SESSION ['cwd ' ]) ;
11+ // If we have no cwd set in session, set it now
12+ if (false === isset ($ _SESSION ['cwd ' ])) {
13+ $ _SESSION ['cwd ' ] = $ docRoot . $ iceRoot ;
1414}
1515
16+ // Change to cwd
17+ chdir ($ _SESSION ['cwd ' ]);
18+
1619// Get current user and cwd
1720$ user = str_replace ("\n" , "" , shell_exec ("whoami " ));
1821$ cwd = str_replace ("\n" , "" , shell_exec ("pwd " ));
@@ -138,9 +141,10 @@ function returnHTMLPromptCommand($cmd) {
138141
139142// Change to the cwd in session
140143chdir ($ _SESSION ['cwd ' ]);
144+
141145// and again ask for current user and working dir
142- $ user = str_replace ("\n" ,"" ,shell_exec ("whoami " ));
143- $ cwd = str_replace ("\n" ,"" ,shell_exec ("pwd " ));
146+ $ user = str_replace ("\n" , "" , shell_exec ("whoami " ));
147+ $ cwd = str_replace ("\n" , "" , shell_exec ("pwd " ));
144148
145149// Finally, output our JSON data
146150echo json_encode ([
Original file line number Diff line number Diff line change 9393
9494<body onclick="document.getElementById('command').focus()">
9595<?php
96- if (true === isset ($ _SESSION ['cwd ' ])) {
97- chdir ($ _SESSION ['cwd ' ]);
96+ // If we have no cwd set in session, set it now
97+ if (false === isset ($ _SESSION ['cwd ' ])) {
98+ $ _SESSION ['cwd ' ] = $ docRoot . $ iceRoot ;
9899}
100+
101+ // Change to cwd
102+ chdir ($ _SESSION ['cwd ' ]);
103+
104+ // Get current user and cwd
99105$ user = str_replace ("\n" , "" , shell_exec ("whoami " ));
100106$ cwd = str_replace ("\n" , "" , shell_exec ("pwd " ));
101107?>
You can’t perform that action at this time.
0 commit comments