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 8
8
'll ' => 'ls -lvhF ' ,
9
9
);
10
10
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 ;
14
14
}
15
15
16
+ // Change to cwd
17
+ chdir ($ _SESSION ['cwd ' ]);
18
+
16
19
// Get current user and cwd
17
20
$ user = str_replace ("\n" , "" , shell_exec ("whoami " ));
18
21
$ cwd = str_replace ("\n" , "" , shell_exec ("pwd " ));
@@ -138,9 +141,10 @@ function returnHTMLPromptCommand($cmd) {
138
141
139
142
// Change to the cwd in session
140
143
chdir ($ _SESSION ['cwd ' ]);
144
+
141
145
// 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 " ));
144
148
145
149
// Finally, output our JSON data
146
150
echo json_encode ([
Original file line number Diff line number Diff line change 93
93
94
94
<body onclick="document.getElementById('command').focus()">
95
95
<?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 ;
98
99
}
100
+
101
+ // Change to cwd
102
+ chdir ($ _SESSION ['cwd ' ]);
103
+
104
+ // Get current user and cwd
99
105
$ user = str_replace ("\n" , "" , shell_exec ("whoami " ));
100
106
$ cwd = str_replace ("\n" , "" , shell_exec ("pwd " ));
101
107
?>
You can’t perform that action at this time.
0 commit comments