File tree 4 files changed +11
-7
lines changed
4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 6
6
7
7
$ command = (isset ($ _GET ["command " ]) and $ _GET ["command " ]!="" ) ? trim ($ _GET ["command " ]) : null ;
8
8
if ($ command !=null ){
9
- lCommand::addToStack ($ command );
10
- }
11
- if (!lConnection::isAuthorized ()){
12
- lCommand::addToStackIfNotExists ("login " );
9
+ if ($ command =="init " ){
10
+ if (!lConnection::isAuthorized ()) lCommand::write ("welcome to the php command line. please login via the command \"login \"" );
11
+ }else {
12
+ lCommand::addToStack ($ command );
13
+ }
13
14
}
14
15
15
16
lCommand::performNextCommand ();
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ static function performNextCommand(){
48
48
$ args = array_slice ($ splits , 1 );
49
49
50
50
// call command
51
+ if ($ command =="" ) return ;
51
52
if (lConnection::isAuthorized () or $ program =="login " ){
52
53
if (file_exists ("programms/ $ program/init.php " )){
53
54
require_once ("programms/ $ program/init.php " );
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ function loginMain($args, $command){
19
19
lCommand::write ("welcome, " .$ username );
20
20
}else {
21
21
lCommand::write ("not authorized " );
22
- lCommand::addToStack ("login " );
23
- lCommand::performNextCommand ();
22
+ // lCommand::addToStack("login");
23
+ // lCommand::performNextCommand();
24
24
}
25
25
}
26
26
}
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ class CommandLine{
63
63
}
64
64
}
65
65
static sendCommand(command){
66
+ console.log(command);
66
67
CommandLine.commandhistory.unshift(command);
67
68
let xhttp = new XMLHttpRequest();
68
69
xhttp.onreadystatechange = function() {
@@ -72,7 +73,7 @@ class CommandLine{
72
73
CommandLine.print(answer["return"]);
73
74
}
74
75
};
75
- xhttp.open("GET", "commandline/?command="+encodeURI (command), true);
76
+ xhttp.open("GET", "commandline/?command="+encodeURIComponent (command), true);
76
77
xhttp.send();
77
78
}
78
79
static print(content){
@@ -87,6 +88,7 @@ class CommandLine{
87
88
}
88
89
CommandLine.commandhistory = [];
89
90
CommandLine.historyindex = -1;
91
+ CommandLine.sendCommand("init");
90
92
</script>
91
93
</head>
92
94
<body onclick="document.getElementsByTagName('textarea')[0].focus();">
You can’t perform that action at this time.
0 commit comments