Contents |
First, shows a form:
argument 1: __________ password : __________ [execute command]
When 'execute command' is clicked, it runs
./command.sh argument1 -ppassword
and shows the output.
<?php
// CAREFUL! THIS SCRIPT IS UNSAFE! PROTECT WITH PASSWORD ACCESS!
if($_POST) {
$argument1 = $_POST['argument1'];
$password = $_POST['password'];
system("./command.sh \"" . $argument1 . "\" -p" . $password . " 2>&1");
}
else {
?>
<h1>Utility Page</h1>
<form method="post" style="width: 500px">
<div style="width:300px;float:left">argument 1:</div>
<input type="text" name="argument1" style="width:200px;float:left;"/><br/>
<div style="width:300px;float:left">password:</div>
<input type="password" name="password" style="width:200px;float:left;"/><br/>
<br />
<input type="submit" value="execute command" />
</form>
<?php
}
?>
Post from a form:
<form action="showResult.php" method="post"> Gender:<br> <input type="radio" name="gender" value="male">Male</input><br> <input type="radio" name="gender" value="female">Female</input><br> Name: <input type="text" size="60" name="name" value="default text"><br> Are you a subscriber? <input type="checkbox" name="subscriber" checked ><br> <input type="submit" value="send" style="width: 100px"> <input type="reset" value="reset" style="width: 100px"> </form>
And receive it with showResult.php:
<pre>
<?php
foreach(array_keys($_POST) as $key) {
echo $key.": '".$_POST[$key]."'\n";
}
?>
</pre>
Encode in URL:
http://www.something.org/showResult.php?name=john&age=30
And receive it with showResult.php:
<pre>
<?php
foreach(array_keys($_GET) as $key) {
echo $key.": '".$_GET[$key]."'\n";
}
?>
</pre>
The following 2 pages are in this category, out of 2 total.