optimize the sumbit action
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
||||||
@@ -19,15 +20,20 @@
|
|||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
changeFrameHeight();
|
changeFrameHeight();
|
||||||
}
|
}
|
||||||
|
document.onkeydown = function(e) { //对整个页面监听
|
||||||
|
var keyNum = window.event ? e.keyCode : e.which;
|
||||||
|
if (keyNum == 13) {
|
||||||
|
document.getElementById("fm").submit();
|
||||||
|
document.getElementById("command").value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<iframe src="./terminal.php" onload="changeFrameHeight()" height="" width="100%" scrolling="auto" frameborder="0" id="if" name="if"></iframe>
|
<iframe src="./terminal.php" onload="changeFrameHeight()" height="" width="100%" scrolling="auto" frameborder="0" id="if" name="if"></iframe>
|
||||||
<form method="post" action="./terminal.php" target="if">
|
<form method="post" action="./terminal.php" target="if" id="fm" onsubmit="return false">
|
||||||
<input name="command" required />
|
<input name="command" id="command" />
|
||||||
<input type="submit" value="Submit" />
|
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -28,16 +28,16 @@ if(!opendir("fileroot")){
|
|||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
$pwd = file_get_contents("pwd.txt");
|
$pwd = file_get_contents("pwd.txt");
|
||||||
file_put_contents("recent.txt", $pwd . " $ " . $_POST['command'] . "<br/>", FILE_APPEND);
|
$commands = explode(" ", $_POST['command']);
|
||||||
|
file_put_contents("recent.txt", $pwd . " $ " . $commands[0] . "<br/>", FILE_APPEND);
|
||||||
$output_str = file_get_contents("recent.txt");
|
$output_str = file_get_contents("recent.txt");
|
||||||
echo $output_str;
|
echo $output_str;
|
||||||
$commands = explode(" ", $_POST['command']);
|
if ($commands[0] == NULL) {
|
||||||
if ($_POST['command'] == NULL) {
|
|
||||||
echo "<script>window.scrollTo(0,document.body.scrollHeight)</script>";
|
echo "<script>window.scrollTo(0,document.body.scrollHeight)</script>";
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if ($_POST['command'] == "pwd") {
|
} else if ($commands[0] == "pwd") {
|
||||||
file_put_contents("recent.txt", $pwd . "<br/>", FILE_APPEND);
|
file_put_contents("recent.txt", $pwd . "<br/>", FILE_APPEND);
|
||||||
} else if ($_POST['command'] == "clear") {
|
} else if ($commands[0] == "clear") {
|
||||||
file_put_contents("recent.txt", "");
|
file_put_contents("recent.txt", "");
|
||||||
} else if ($commands[0] == "help") {
|
} else if ($commands[0] == "help") {
|
||||||
$help = file_get_contents("static/terminal.php/help.txt");
|
$help = file_get_contents("static/terminal.php/help.txt");
|
||||||
|
|||||||
Reference in New Issue
Block a user